Amazon interview question

BFS on a 2 dimensional grid.