Skip to content

Commit ea63b9c

Browse files
Merge pull request PawanJaiswal08#107 from IamSohamDey/patch-3
Create UniquePaths.py
2 parents d56c8a4 + 3141fd0 commit ea63b9c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

UniquePaths.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution:
2+
def uniquePaths(self, m: int, n: int) -> int:
3+
4+
dp = [[0 for j in range(0, n)] for i in range(0, m)]
5+
6+
for i in range(0, m):
7+
dp[i][0] = 1
8+
9+
for j in range(0, n):
10+
dp[0][j] = 1
11+
12+
for i in range(1, m):
13+
for j in range(1, n):
14+
dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
15+
16+
17+
return dp[m - 1][n - 1]

0 commit comments

Comments
 (0)