Skip to content

Commit

Permalink
Updated task-5
Browse files Browse the repository at this point in the history
  • Loading branch information
Atharvasaraiya committed Oct 2, 2023
1 parent 9c81e15 commit e34b563
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 e34b563

Please sign in to comment.