Last active
February 26, 2018 14:28
-
-
Save sirupsen/2164021 to your computer and use it in GitHub Desktop.
An extremely simple dynamic programming fibonacci implementation in Ruby using hashes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fibonacci | |
h = Hash.new { |hash,key| hash[key] = hash[key-1] + hash[key-2] } | |
h[1] = 0 | |
h[2] = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment