AlgoViz

Design an LRU cache

medium 85 min

Design an in-memory Least Recently Used cache with O(1) lookups, updates and evictions.

Watch lesson4:49

Mock interview

Answer against the clock, then score yourself.

0:00 of 45:00

Design an in-memory cache with a fixed capacity that evicts the least recently used entry. Later it will be used by many threads.

Step 1 of 6 · 4 min

Contract

Interviewer

What exactly will you build?

Cheat sheet (open after you finish)

Forty-five minutes, alone, with a timer. Write real code in the third stage. Open the pushback only when you have answered.