We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0b0bb1b commit 3ca64baCopy full SHA for 3ca64ba
unique-paths/evan.py
@@ -0,0 +1,10 @@
1
+class Solution:
2
+ def uniquePaths(self, m: int, n: int) -> int:
3
+ dp = [[1] * n for _ in range(m)]
4
+
5
+ # Iterate over the grid starting from 1,1 to fill the number of unique paths for each cell
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]
0 commit comments