Design an LRU cache

medium~30 min#caching#concurrency#data-structures#lld

Design a fixed-capacity LRU cache with O(1) get and put.

Then answer the follow-up: what happens when it is used from multiple threads, and what would you change?

Solution — locked

Sign in to unlock this one

The solution opens once you explain the idea in your own words and it passes the grader — which needs an account to record. Signing in is free.

Log in