[LeetCode Python3] 62. Unique Paths

62. Unique Paths

class Solution:
    def uniquePaths(self, m: int, n: int) -> int:
        res = [[1]*n for _ in range(m)]
        for i in range(1, m):
            for j in range(1, n):
                res[i][j] = res[i-1][j] + res[i][j-1]
        return res[-1][-1]

版权声明:本文为xvrixingkong原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。