Skip to content

Commit b89d4a2

Browse files
committed
[Add] Leetcode > 62. Unique Paths
1 parent dd01e11 commit b89d4a2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Leetcode/unique_paths.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# 62. Unique Paths
2+
3+
class Solution:
4+
def uniquePaths(self, m: int, n: int) -> int:
5+
map = [[0] * (m) for _ in range(n)]
6+
7+
for i in range(n):
8+
for j in range(m):
9+
if i == 0 or j == 0 : map[i][j] = 1
10+
else:
11+
map[i][j] = map[i-1][j] + map[i][j-1]
12+
13+
return map[-1][-1]

0 commit comments

Comments
 (0)