Choose the structures
Warm-up · Multiple choice · about 3 min
An LRU cache needs get and put in O(1). Each must find a key, move it to the most recent end, and evict the least recently used key when full. Which pair of structures does that?
Learn the idea first: LRU and LFU caches, a visual lesson.
More LRU and LFU caches problems
- Count cache misses Warm-up
- Predict evictions Standard
- LRU cache Standard
- Spot the bug: get forgets the order Standard
- LFU cache Challenge