Created
February 27, 2021 04:56
-
-
Save eengineergz/b1b1f7e259193ecdc432350b6199f2d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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