Given an m x n integer matrix, return the length of the longest strictly increasing path, moving only up, down, left, or right at each step (no wraparound).
matrix = [[9,9,4],[6,6,8],[2,1,1]]4Solve it in the editor. Sign in free to run your Python or JavaScript against test cases, get a verdict, and track your attempts.
Solve on FeatCode →The same DP idea as 1-D, but the state depends on two indices — often two positions in a grid, or a position in each of two sequences being compared.
Read the full 2-D Dynamic Programming guide →
Original problem on LeetCode ↗