Skip to content
We areTOP 1%

Longest Increasing Path in a Matrix

HardLeetCodeMixed Practice
Solve on LeetCode(opens in a new tab)
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews
Approach hintTry it first, then reveal

Strictly increasing moves can never form a cycle, so a memoised DFS is safe: the longest path from a cell is one plus the best result among its larger neighbours. Each cell is solved once, O(mn).

More in Mixed Practice

Mixed Practice questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1BerpizzaCodeforcesMedium 1400Solve Berpizza on Codeforces (opens in a new tab)
2Search Suggestions SystemLeetCodeMedium Solve Search Suggestions System on LeetCode (opens in a new tab)
3Interleaving StringLeetCodeMedium Solve Interleaving String on LeetCode (opens in a new tab)
4Knight TournamentCodeforcesMedium 1500Solve Knight Tournament on Codeforces (opens in a new tab)
5Linova and KingdomCodeforcesMedium 1600Solve Linova and Kingdom on Codeforces (opens in a new tab)
6Ehab the XorcistCodeforcesMedium 1700Solve Ehab the Xorcist on Codeforces (opens in a new tab)
7Andrey and Escape from CapygradCodeforcesHard 1800Solve Andrey and Escape from Capygrad on Codeforces (opens in a new tab)
8Swim in Rising WaterLeetCodeHard Solve Swim in Rising Water on LeetCode (opens in a new tab)
9Longest Increasing Path in a MatrixLeetCodeHard Solve Longest Increasing Path in a Matrix on LeetCode (opens in a new tab)
10Maximum Profit in Job SchedulingLeetCodeHard Solve Maximum Profit in Job Scheduling on LeetCode (opens in a new tab)
11Binary Tree CamerasLeetCodeHard Solve Binary Tree Cameras on LeetCode (opens in a new tab)
12Number of Good PathsLeetCodeHard Solve Number of Good Paths on LeetCode (opens in a new tab)
13Tree with Maximum CostCodeforcesHard 1900Solve Tree with Maximum Cost on Codeforces (opens in a new tab)

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account