All problems
Foundational·🛠️ Developer Tools·Amazon · Google · Microsoft +1

Design
Simple LRU Cache

Design an in-memory Least Recently Used (LRU) cache with O(1) get and put operations.

This is a Low-Level Design (LLD) problem. New to LLD vs HLD? Start here.

#Data Structures#HashMap#Linked List
5F + 2NF requirements inside

01 -  Why interviewers ask this

It's one of the most common data-structure-design questions in the industry — interviewers specifically check for the HashMap + doubly-linked-list combo that gives true O(1) get/put.

02 -  Where this system exists in the real world

You interact with this design every day.

Database and CDN caching layers

Browser and OS page-replacement caches

In-memory caches inside web frameworks

03 -  What you'll master

Solve this once. Know it forever.

01

Combine a HashMap and doubly linked list for O(1) ops

02

Implement eviction policy correctly under capacity

03

Reason about time complexity rigorously

04 -  What you'll design

5 functional · 2 non-functional requirements.

get(key) returns the value if present, else -1/null

4 more requirements inside

Sign in to unlock the full brief and start designing

05 -  Companies that ask this

You may face this exact question in your next interview.

A
Amazon
G
Google
M
Microsoft
M
Meta

Ready?

Open the canvas.
Design it yourself.

See all requirements, use staged hints, run your code, and compare with community discussions - all on the same canvas.