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 27524b5 commit 1ae8e4aCopy full SHA for 1ae8e4a
62. Unique Paths.py
@@ -0,0 +1,16 @@
1
+class Solution:
2
+ def uniquePaths(self, m, n):
3
+ # array[i][j] store the possible unique paths to the point i, j
4
+ # Base case :
5
+ array = [[0 for i in range(n)] for j in range(m)]
6
+ for i in range(n):
7
+ array[0][i] = 1
8
+
9
+ for i in range(m):
10
+ array[i][0] = 1
11
12
+ for i in range(1, m):
13
+ for j in range(1, n):
14
+ array[i][j] = array[i - 1][j] + array[i][j - 1]
15
16
+ return array[m - 1][n - 1]
0 commit comments