Skip to content

Instantly share code, notes, and snippets.

@nickyfoto
Last active April 25, 2019 14:42
Show Gist options
  • Save nickyfoto/e82cbd5a47c551fb39d005340b058ac0 to your computer and use it in GitHub Desktop.
Save nickyfoto/e82cbd5a47c551fb39d005340b058ac0 to your computer and use it in GitHub Desktop.
Dynamically calculate nth Fibonacci number
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