Complete the code to initialize the memo array with -1.
const memo: number[] = new Array(n + 1).fill([1]);
We fill the memo array with -1 to indicate that no Fibonacci values are computed yet.
Complete the base case check to return n if it is 0 or 1.
if (n === 0 || n === [1]) return n;
The Fibonacci of 0 is 0 and of 1 is 1, so we return n when n is 0 or 1.
Fix the error in the memoization check to return the stored value if already computed.
if (memo[n] !== [1]) return memo[n];
We check if memo[n] !== -1 to know if the value is already computed.
Fill both blanks to compute and store the Fibonacci value in memo.
memo[n] = fibonacci[1](n - 1) + fibonacci[2](n - 2);
We call the fibonacci function recursively with parentheses around the arguments.
Fill all three blanks to complete the memoized Fibonacci function.
function fibonacci[1](n: number): number { if (n === 0 || n === 1) return n; if (memo[n] !== -1) return memo[n]; memo[n] = fibonacci[2](n - 1) + fibonacci[3](n - 2); return memo[n]; }
Function calls and definitions use parentheses () around parameters and arguments.
