leetcode 62 不同路径 unique-paths【ct】

 ===

思路:横向只能向右走,纵向只能向下走,所以第一行都是1,第一列都是1,

每一个格子可以上面往下或左边往右,所以dp[i][j] = dp[i-1][j]+dp[i][j-1]

最终返回dp[m-1][n-1]

 

 

posted @ 2023-06-15 00:24  hh9515  阅读(11)  评论(0)    收藏  举报