← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Problem Statement
Given an m x n integer matrix, return the length of the longest increasing path in the matrix. From each cell, you can move in four directions: left, right, up, or down. An increasing path is a sequence of cells where each cell's value is strictly greater than the previous cell's value, and no cell is revisited.[3][9]
Example 1
Input: matrix = [,,][1][2][4][6][8][9]
Output: 4
Explanation: The longest increasing path is.[2][6][7][9][1]
Example 2
Input: matrix = [,,][4][5][6][1][2][3]
Output: 4
Explanation: The longest increasing path is.[5][6][7][3][4]
Example 3
Input: matrix = [,,][6][7][8][9][1][2][3][4][5]
Output: 9
Explanation: The entire matrix forms one increasing path.[5]
Constraints