We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 23dabe3 commit 6aeabf0Copy full SHA for 6aeabf0
Algorithms/Medium/62_UniquePaths/Solution.py
@@ -0,0 +1,12 @@
1
+class Solution:
2
+ def uniquePaths(self, m: int, n: int) -> int:
3
+ bottom_row = [1] * n
4
+
5
+ for column in range(m - 1):
6
+ new_row = [1] * n
7
8
+ for i in range(n - 2, -1, -1):
9
+ new_row[i] = new_row[i + 1] + bottom_row[i]
10
+ bottom_row = new_row
11
12
+ return bottom_row[0]
0 commit comments