Yahoo Interview Question

First round was easy with basic array questions. Learn binary search, tree traversal and stacks. Last round was DFS on a matrix which I couldnt do.