Meta Interview Question

Two dimensional BFS floodfill problem