Skip to content

Instantly share code, notes, and snippets.

@rono23
Created February 6, 2010 05:41
Show Gist options
  • Save rono23/296568 to your computer and use it in GitHub Desktop.
Save rono23/296568 to your computer and use it in GitHub Desktop.
def fibonacci(num, current, prev, fibo=[])
return fibo if num < 1
fibo << current
fibonacci(num - 1, current + prev, current, fibo)
end
fibonacci(10, 1, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment