-
-
Save amankharwal/dbf9661edfac464c7b10bbf50366f047 to your computer and use it in GitHub Desktop.
This file contains 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 fibonacci(n): | |
memo = [1,1] # f(0) = 1, f(1) = 1 | |
for i in range(2, n+1): | |
memo.append(memo[i-1] + memo[i-2]) | |
return memo[n] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment