Skip to content

Instantly share code, notes, and snippets.

@CliveEvans
Last active November 5, 2018 20:30
Show Gist options
  • Save CliveEvans/be1f7ad49272de5fecf19faf0ca7665a to your computer and use it in GitHub Desktop.
Save CliveEvans/be1f7ad49272de5fecf19faf0ca7665a to your computer and use it in GitHub Desktop.
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