New update is available. Click here to update.

Posted: 27 Nov, 2020

Difficulty: Moderate

```
Input: Mat [ ][ ] = { { 9 , 1 , 3 }
{ 7 , 4 , 2 }
{ 6 , 5 , 8 } }
Output: 4
Explanation: The longest path is of length ‘4’ { 4 - 5 - 6 - 7 }
```

```
The first line contains a single integer ‘T’ denoting the number of test cases to be run. Then the test cases follow.
The first line of each test case contains a single integer 'N' denoting the size of the matrix as N*N.
‘N’ lines follow. Each of the next ‘N’ lines contains ‘N’ space separated integers separated by space.
```

```
For each test case, return an integer denoting the maximum length path.
Output for each test case should be printed in a separate line.
```

```
You are not required to print anything, it has already been taken care of. Just implement the function.
```

```
1 <= T <= 100
1 <= N <= 10^3
Time Limit : 1 sec
```

SIMILAR PROBLEMS

SudoKube

Posted: 18 May, 2022

Difficulty: Ninja

SudoKube

Posted: 18 May, 2022

Difficulty: Ninja

King Placement

Posted: 22 May, 2022

Difficulty: Moderate

Ninja and the experiment

Posted: 5 Sep, 2022

Difficulty: Moderate

Search In A Sorted 2D Matrix

Posted: 23 Nov, 2022

Difficulty: Moderate

Spiral Matrix

Posted: 24 Nov, 2022

Difficulty: Easy

Categories:

Popular Courses: