All challenges
Code AnalysisIntermediate 45s

Memoization example

What does this memoized function return on second call?
Starter code
const memo = {};
function fib(n) {
  if (memo[n]) return memo[n];
  if (n <= 1) return n;
  memo[n] = fib(n-1) + fib(n-2);
  return memo[n];
}
fib(10); fib(10); // second call?

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle