题目链接:https://leetcode.com/problems/unique-paths/
自己的思路
代码
class Solution:
def uniquePaths(self, m, n) -> int:
while not m or not n : return 0
dp = [[0 for col in range(n)] for row in range(m)]
for i in range(m):
for j in range(n):
if j and i :
dp[i][j]=dp[i][j-1]+dp[i-1][j]
elif not j and i:
dp[i][j]=dp[i-1][j]
elif not i and j:
dp[i][j]=dp[i][j-1]
else :
dp[i][j]=1
return dp[m-1][n-1]