Skip to content

Instantly share code, notes, and snippets.

@PedroEscudero
Created February 19, 2020 21:11
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 PedroEscudero/631686d7526c4e2fb8d3ece8247373f6 to your computer and use it in GitHub Desktop.
Save PedroEscudero/631686d7526c4e2fb8d3ece8247373f6 to your computer and use it in GitHub Desktop.
def fibonacci(n)
return n if ( 0..1 ).include? n
(fibonacci(n - 1) + fibonacci( n - 2 ))
end
start = Time.now
fibonacci(22)
p Time.now - start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment