62. 不同路径 - 力扣(LeetCode)
class Solution:def uniquePaths(self, m: int, n: int) -> int:dp = [1] * n # 仅保留一行for i in range(1, m):for j in range(1, n):dp[j] += dp[j-1]return dp[-1]
62. 不同路径 - 力扣(LeetCode)
class Solution:def uniquePaths(self, m: int, n: int) -> int:dp = [1] * n # 仅保留一行for i in range(1, m):for j in range(1, n):dp[j] += dp[j-1]return dp[-1]