Last active
May 8, 2019 14:27
-
-
Save wildskyf/d3be81f73fea07d5f6ddb207a9365da3 to your computer and use it in GitHub Desktop.
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
var map = {} | |
function fibonacci(n) { | |
if (n <= 1) return n | |
map[n-2] = map[n-2] || fibonacci(n-2) | |
map[n-1] = map[n-1] || fibonacci(n-1) | |
return map[n-2] + map[n-1] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment