LearnPy Hub
← Arena
AdvancedRating 1800

Longest Climb in a Grid

Print the length (in cells) of the longest strictly increasing path in the grid, moving up, down, left or right.

Input

r and c, then r rows.

Output

One integer.

Sample 1

Input
3 3
9 9 4
6 6 8
2 1 1
Output
4

Sample 2

Input
3 3
3 4 5
3 2 6
2 2 1
Output
4
solution.py
Output appears here
Longest Climb in a Grid · Python Arena problem · LearnPy Hub