Skip to content

Instantly share code, notes, and snippets.

@eporroa
Last active August 29, 2015 14:04
Show Gist options
  • Save eporroa/4cb1e1d15e9819d69505 to your computer and use it in GitHub Desktop.
Save eporroa/4cb1e1d15e9819d69505 to your computer and use it in GitHub Desktop.
My fast fibonacci
function fibonacci(n) {
return Array.apply(0, Array(n+1)).reduce(function(prev, curr, index, arr){
return prev.concat((index < 2) ? index : prev[index-1] + prev[index-2]);
}, []).pop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment