Skip to content

Instantly share code, notes, and snippets.

@MichaelQQ
Last active June 9, 2016 16:39
Show Gist options
  • Save MichaelQQ/c7e231ee1deb0465ef7e85663d8c1f5c to your computer and use it in GitHub Desktop.
Save MichaelQQ/c7e231ee1deb0465ef7e85663d8c1f5c to your computer and use it in GitHub Desktop.
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