Skip to content

Commit 72668e7

Browse files
committed
unique paths solution
1 parent 2521eb6 commit 72668e7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

unique-paths/devyejin.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# 시간 복잡도 O(mn), 공간복잡도 O(mn)
2+
class Solution:
3+
def uniquePaths(self, m: int, n: int) -> int:
4+
dp = [[1] * n for _ in range(m)]
5+
6+
for i in range(1, m):
7+
for j in range(1, n):
8+
dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
9+
10+
return dp[m - 1][n - 1]
11+

0 commit comments

Comments
 (0)