bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
Hard2-D Dynamic ProgrammingLC 329

Longest Increasing Path In a Matrix

Given an m x n integers matrix, return the length of the longest increasing path in matrix. From each cell, you can either move in four directions: left, right, up, or down. You may not move diagonally or move outside the boundary (i.e., wrap-around is not allowed).

Asked at 10 companies
AdobeAmazonApple
Hints
  • 1.Think about what data structure fits Longest Increasing Path In a Matrix
  • 2.Consider the brute force complexity and how to optimize
  • 3.Can you trade space for time?
LeetCodeNeetCode