Meta·Software Engineer·Technical Phone Screen
- Given an m x n integer matrix, find the length of the longest path of strictly increasing values where movement is restricted to up, down, left, and right. Design an efficient algorithm and walk through its time and space complexity.
- Follow-up: for very large matrices where deep recursion could cause a stack overflow, how would you redesign the solution to be iterative or otherwise avoid blowing the call stack?
“I went straight to DFS with memoization, which is the right call, but I fumbled explaining why the memoization was valid here.”