Skip to content

Latest commit

 

History

History
9 lines (5 loc) · 306 Bytes

index.md

File metadata and controls

9 lines (5 loc) · 306 Bytes

思路:

这题需要用动态规划的思想。

设 dp[i][j] 为到第 i,j 节点的最大单调递增路径的长度。

我们需要用 dfs (深度优先) 的,通过递归的获取每个节点的最长路径,如果 dp[i][j] = 0 则需要继续去找路径 如果不等于 0 则直接返回。