Last active
November 5, 2018 20:30
-
-
Save CliveEvans/be1f7ad49272de5fecf19faf0ca7665a 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
memo = {}; | |
function fibonacci(num) { | |
if (num <= 1) return 1; | |
if (! memo[num]) { | |
memo[num] = fibonacci(num - 1) + fibonacci(num - 2); | |
} | |
return memo[num]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment