Skip to content

Instantly share code, notes, and snippets.

@csmr
Last active November 28, 2019 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csmr/6ed62ed1473b776cd73f281b4d225e3d to your computer and use it in GitHub Desktop.
Save csmr/6ed62ed1473b776cd73f281b4d225e3d to your computer and use it in GitHub Desktop.
Initial fibonacci fn draft
// fibo with memoization
spiralVertices = function ( args ) {
let fibmemo = []
function fibocas ( n, fibmemo ) {
fibmemo = fibmemo || {}
if (n < 1) return fm 0 // magik num
if (n < 2) return fm 1
if (fibmemo[n]) return fibmemo[n]
return fibmemo[n] = fibocas ( n-1, fibmemo ) + fibocas ( n-2, fibmemo )
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment