Build an LRU Cache
Talk it through out loud with your AI coach.
The problem
- medium
- Pro
Design a cache with a fixed capacity that supports getting and putting values by key, both in constant time. When it's full, putting a new key must evict the least recently used one.