Skip to content

Commit

Permalink
Merge pull request #340 from Atharvasaraiya/task=5
Browse files Browse the repository at this point in the history
Task=5
  • Loading branch information
Ananyasingh2002 authored Oct 2, 2023
2 parents 5418f69 + e34b563 commit 99821fc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Project/Python Progs/Dynamic programming.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def fibonacci_tabulation(n):
if n <= 1:
return n
fib = [0] * (n+1)
fib[1] = 1
for i in range(2, n+1):
fib[i] = fib[i-1] + fib[i-2]
return fib[n]

# Example usage:
print(fibonacci_tabulation(10)) # Output: 55

0 comments on commit 99821fc

Please sign in to comment.