Created
December 6, 2014 18:39
-
-
Save simon0191/bc93a6160e5c1aba33e3 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 memo = { | |
0: 1, | |
1: 1 | |
}; | |
function fib(n) { | |
if(memo[n]) return memo[n]; | |
return (memo[n] = fib(n-1) + fib(n-2)); | |
} | |
var main = fib; | |
//console.log(main(8)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment