简单的动态规划
class Solution(object):
def uniquePaths(self, m, n):
"""
:type m: int
:type n: int
:rtype: int
"""
# set 0 row to 1
arr = [[1 for i in range(n) ]]
#count
for i in range(1,m):
for j in range(n):
if j == 0:
arr.append([1])
continue
arr[i].append((arr[i-1][j] + arr[i][j-1]))
return arr[m-1][n-1]
s = Solution()
print(s.uniquePaths(1,2))