Skip to content

Instantly share code, notes, and snippets.

@mym0404
Created May 17, 2022 08:42
Show Gist options
  • Save mym0404/7bd1d6a975fb6f06bb37bd33024e3c2a to your computer and use it in GitHub Desktop.
Save mym0404/7bd1d6a975fb6f06bb37bd33024e3c2a to your computer and use it in GitHub Desktop.
n = 100
checked = [-1 for _ in range(n)]
def fib(i):
if i <= 2: return 1
global checked
if checked[i] != -1:
return checked[i]
checked[i] = fib(i - 2) + fib(i - 1)
return checked[i]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment