Created
June 15, 2018 15:55
-
-
Save GammaGames/10506713480af9c7b5f94ce2b61fd804 to your computer and use it in GitHub Desktop.
python3 fib
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
from functools import lru_cache | |
@lru_cache(None) | |
def fib(n): | |
return n if n < 2 else fib(n-1) + fib(n-2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment