Skip to content

Commit a4c2367

Browse files
committed
Update solution 062 [Python3]
1 parent 2b8d742 commit a4c2367

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

solution/062.Unique Paths/Solution.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution:
2+
def uniquePaths(self, m, n):
3+
"""
4+
:type m: int
5+
:type n: int
6+
:rtype: int
7+
"""
8+
res = [[0]*m]*n
9+
for i in range(n):
10+
for j in range(m):
11+
if i == 0 or j==0:
12+
res[i][j] = 1
13+
else:
14+
res[i][j] = res[i][j-1]+res[i-1][j]
15+
return res[n-1][m-1]

0 commit comments

Comments
 (0)