LintCode 114. Unique Paths
程序员文章站
2022-07-16 11:38:02
...
题目
思路
dp,滚动数组
代码
class Solution:
"""
@param m: positive integer (1 <= m <= 100)
@param n: positive integer (1 <= n <= 100)
@return: An integer
"""
def uniquePaths(self, m, n):
# write your code here
dp = [1 for i in range(n)]
for i in range(1, m):
for j in range(1, n):
dp[j] = dp[j - 1] + dp[j]
return dp[n - 1]
推荐阅读
-
LintCode 114. Unique Paths
-
63. Unique Paths II 动态规划
-
63. Unique Paths II 动态规划
-
【leetcode】Unique Paths II(动态规划)
-
LeetCode 63. Unique Paths II(动态规划)
-
[LeetCode] Unique Paths && Unique Paths II && Minimum Path Sum (动态规划之 Matrix DP )
-
动态规划----unique paths
-
【LeetCode62 Unique Paths】动态规划计算路径
-
【动态规划】LeetCode 63. Unique Paths II
-
牛客网_leetcode_unique-paths-ii(动态规划)