Skip to content

Instantly share code, notes, and snippets.

@eengineergz
Created February 27, 2021 04:56
Show Gist options
  • Save eengineergz/b1b1f7e259193ecdc432350b6199f2d3 to your computer and use it in GitHub Desktop.
Save eengineergz/b1b1f7e259193ecdc432350b6199f2d3 to your computer and use it in GitHub Desktop.
function tabFib(n) {
let table = new Array(n);
table[0] = 0;
table[1] = 1;
table[2] = 1;
for (i = 3; i <= n; i++) {
table[i] = table[i - 1] + table[i - 2];
console.log(table);
}
return table[n];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment