Problem
Given an m × n integer matrix, return the length of the longest strictly increasing path. From a cell you may move up, down, left or right (no diagonals, and no wrapping around the edges). Each step must go to a strictly larger value.
Example 1
matrix = [[9, 9, 4],
Example 2
[6, 6, 8],
Example 3
- Input
- [2, 1, 1]]
- Output
- 4
- Why
- 1 → 2 → 6 → 9
Example 4
matrix = [[3, 4, 5],
Example 5
[3, 2, 6],
Example 6
- Input
- [2, 2, 1]]
- Output
- 4
- Why
- 3 → 4 → 5 → 6
Constraints
1 <= m, n <= 200 where the matrix is m × n0 <= matrix[r][c] <= 2^31 - 1