Skip to content

Instantly share code, notes, and snippets.

@citadelgrad
Created September 25, 2019 16:48
Show Gist options
  • Save citadelgrad/ebf9bd2dc5d4304e76d37674c25e3d2c to your computer and use it in GitHub Desktop.
Save citadelgrad/ebf9bd2dc5d4304e76d37674c25e3d2c to your computer and use it in GitHub Desktop.
from functools import lru_cache
@lru_cache(1000)
def fibonacci(n):
if n == 0:
return 0
elif n == 1:
return 1
return fibonacci(n - 1) + fibonacci(n - 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment