Skip to content

Instantly share code, notes, and snippets.

@kentwait
Last active November 6, 2018 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kentwait/9b48746bb225f7f43ab3a7d91657e494 to your computer and use it in GitHub Desktop.
Save kentwait/9b48746bb225f7f43ab3a7d91657e494 to your computer and use it in GitHub Desktop.
def fibo_r(x):
if x <= 2:
return 1
return fibo_r(x-1) + fibo_r(x-2)
def fibo_l(x):
l = [0, 1, 1]
if x <= 2:
return 1
for i in range(3, x):
l.append(l[-2] + l[-1])
return l[-2] + l[-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment