Bounded Least-Recently-Used Cache

Asked at Microsoft · Coding Questions · Difficulty: Medium · Last asked Apr 21, 2026

Design a bounded cache that remembers the most recently used entries. When it is full and a new key arrives, it discards the entry that has gone unused for the longest time. Both lookups and inserts must stay fast as the cache grows.

Loading the problem…