class Solution:
"""
@param n and m: positive integer(1 <= n , m <= 100)
@return an integer
"""
def uniquePaths(self, m, n):
# write your code here
ans = [[1 for i in range(n)] for i in range(m)]
for i in range(1, m):
for j in range(1, n):
ans[i][j] = ans[i - 1][j] + ans[i][j - 1]
return ans[m-1][n-1]
LintCode:不同的路径
最新推荐文章于 2017-10-08 21:07:11 发布