Problems / Longest Increasing Path in a Matrix
Hard

Longest Increasing Path in a Matrix

Hard 17 submissions 50 coins +200 XP
Dynamic Programming Graph Matrix
Problem Description
From any cell you may move up, down, left or right to a cell with a **strictly larger** value. Return the number of cells on the longest such path. **Example 1:** ``` Input: matrix = [[9, 9, 4], [6, 6, 8], [2, 1, 1]] Output: 4 ``` **Example 2:** ``` Input: matrix = [[3, 4, 5], [3, 2, 6], [2, 2, 1]] Output: 4 ``` **Example 3:** ``` Input: matrix = [[1]] Output: 1 ```
Constraints
- `1 <= rows, cols <= 200` - `0 <= matrix[i][j] <= 2^31 - 1`

Need help?

Connect with expert programmers for real-time collaborative coding, video meetings, and whiteboard sessions via CodeConnect.

Video Call Whiteboard Live Coding Screen Share