Unique Paths
Mon Dec 19 2022 19:32:39 GMT+0000 (Coordinated Universal Time)
Saved by
@akshat202002
#recursion
#python
def uniquePaths(n, m):
if (n == 1 or m == 1):
return 1
else:
return uniquePaths(n - 1, m) + uniquePaths(n, m - 1)
print(uniquePaths(3, 3))
content_copyCOPY
# No of Unique Paths in a grid of m * n from [1,1] to [m,n]
1. Think of the smallest possible input.
2. Visualize by writing out different examples.
3. Relate hard cases with simple cases i.e. Try to find out the relationship between different examples that are related.
4. Generalize the pattern.
{ width=50% }
5. Write the code
https://youtu.be/ngCos392W4w
Comments