Build an LRU Cache

Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.

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.

Talk this problem through with an AI coach

This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.

Start free →