Amazon interview question

BFS Traversal in a Matrix