Skip to content

Commit

Permalink
more recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
scoutjohn committed Feb 15, 2025
1 parent e0e3058 commit 999c65f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions DSA/recursion/Staircase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def number_of_path(n):
if n < 0:
return 0
if n == 0 or n == 1:
return 1

return number_of_path(n - 1) + number_of_path(n - 2) + number_of_path(n - 3)


if __name__ == '__main__':
print(number_of_path(4))

0 comments on commit 999c65f

Please sign in to comment.