LinkedIn Interview Question

DFS/BFS, 2D matrix