Grokking the Art of Recursion for Coding Interviews
0% completed
Recursive Algorithm Strategies
.....
.....
.....
Like the course? Get enrolled and start learning!
A
Anonymous
· 2 years ago
// Function to compute the nth Fibonacci number function fibonacci(n) { // Create a table to store Fibonacci numbers let fibTable = new Array(n+1).fill(0); // Base cases fibTable[0] = 0; fibTable[1] = 1; // Fill fibTable in bottom-up manner for(let i = 2; i <= n; i++) { fibTable[i] = fibTable[i-1] + fibTable[i-2]; } // Return nth Fibonacci number return fibTable[n]; } let n = 13; console.log("Fibonacci number of " + n + " is " + fibonacci(n));
A
Anonymous
· 2 years ago
There is an extra space in the word
techn ique
Reading Progress
0%