Skip to content

Instantly share code, notes, and snippets.

@maysam
Created June 13, 2022 09:25
Show Gist options
  • Save maysam/1b26bc699074ed0f0d29475998e4d577 to your computer and use it in GitHub Desktop.
Save maysam/1b26bc699074ed0f0d29475998e4d577 to your computer and use it in GitHub Desktop.
@answers = {0 => 0, 1 => 1}
def fibonnaci(n)
return 0 if n < 0
@answers[n] ||= fibonnaci(n-1) + fibonnaci(n-2)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment