思路:
稍后写~
代码:
class Solution:
def uniquePaths(self, m: int, n: int) -> int:
#初始化
sum = [] #保存最后的结果,二维数组list[list[]]
new = [1 for i in range(0,n)]
sum.append(new)
for i in range(1,m):
new = []
for j in range(0,n):
if j == 0:
new.append(sum[i-1][j])
else:
num = sum[i-1][j] + new[j-1]
new.append(num)
sum.append(new)
return sum[m-1][n-1]