Last active
April 25, 2019 14:42
-
-
Save nickyfoto/e82cbd5a47c551fb39d005340b058ac0 to your computer and use it in GitHub Desktop.
Dynamically calculate nth Fibonacci number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fibD(n): | |
"""DP Fib""" | |
f = [0, 1] | |
for i in range(2, n+1): | |
f.append(f[i-2]+f[i-1]) | |
return f[n] | |
fib(25) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment