Last active
June 9, 2016 16:39
-
-
Save MichaelQQ/c7e231ee1deb0465ef7e85663d8c1f5c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
let m = {}; | |
const fib = n => { | |
if (m[n]) { | |
return m[n]; | |
} | |
if (n < 2) { | |
return 1; | |
} | |
m[n] = fib(n-1) + fib(n-2); | |
return m[n]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment