Skip to content

Instantly share code, notes, and snippets.

@haydenk
Created November 29, 2021 15:30
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 haydenk/9592b9ee65ada55f27a2c5387c9f1f97 to your computer and use it in GitHub Desktop.
Save haydenk/9592b9ee65ada55f27a2c5387c9f1f97 to your computer and use it in GitHub Desktop.
Recursive Fibonacci
def fibonacci(n: int) -> int:
abs_n: int = abs(n)
if abs_n < 2:
return 0
if abs_n < 3:
return 1
return fibonacci(abs_n-1) + fibonacci(abs_n-2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment