Skip to content

Instantly share code, notes, and snippets.

@taybenlor
Created February 22, 2012 05:25
Show Gist options
  • Save taybenlor/1881673 to your computer and use it in GitHub Desktop.
Save taybenlor/1881673 to your computer and use it in GitHub Desktop.
function fib(n){
if(n < 2) return 1;
if(fib[n]) return fib[n];
return fib[n] = fib(n-1) + fib(n-2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment