Memoization Playground

The neighbourhood head works out fib(n) on a row of scoreboards: without a memo he works it out every time, with one the board keeps its answer, and an…

Why it matters

The core of many optimisations: useMemo/React.memo, HTTP caches, dynamic programming. Knowing “keep results per argument, but only for pure functions” means knowing when speeding up is safe and when a cache hands back stale answers.

The key idea

Memoization keeps results per argument

Common mistakes

Try it in this playground