Skip to content

Instantly share code, notes, and snippets.

Created Nov 4, 2020
What would you like to do?
def fibonacci(n):
memo = [1,1] # f(1) = 1, f(2) = 1
for i in range (2, n):
memo[i%2] = memo[0] + memo[1]
return memo[n%2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment