One of the most common mistakes while solving graph problems on matrices is accidentally turning an O(m*n) problem into exponential recursion 😅

This problem is a perfect example of how DFS + Memoization can optimize brute force beautifully.

Given an m x n matrix, find the length of the longest increasing path.

You can move only in 4 directions:

⬆️ Up