Amazon interview question

Simple Matrix Traversal Question using BFS