LLD
from zero to hero
Fifteen of the most-asked Low-Level Design interview problems, each taken from a bare problem statement to a working C++ design. No prior LLD knowledge assumed. Every chapter names the pattern being tested and ends with a complete, runnable solution.
Before You StartHow to Read This Book
Each chapter follows the same rhythm: the problem statement exactly as an interviewer would hand it to you (context, requirements, the interface you're expected to fill in, and what's actually being tested), then how to approach it (the reasoning that gets you from a blank page to the design, in the order you'd think it through in the room), then the whole solution as one complete C++ listing you can read top to bottom or paste and compile.
The book is graded Easy, Medium, Hard by how many subsystems interact and how much concurrency is really at stake. Easy chapters are one clean pattern in isolation. Medium chapters make two or three patterns cooperate under real constraints (seat locks, dispatch queues, balance sheets). Hard chapters add multiple actors, multiple state machines, or both at once.
Pattern overlaps worth exploiting across chapters: State shows up in Vending Machine, ATM Machine, Elevator System, Ride-Sharing and Food Delivery. Chain of Responsibility connects the ATM's cash dispenser to the Logging Framework's level handling. Strategy is nearly everywhere — win rules, split types, dispatch algorithms, rate-limiting algorithms. Observer plus real concurrency ties together BookMyShow, Ride-Sharing and Message Queue / Pub-Sub. Once one of these clicks in one chapter, you'll recognize it wearing a different costume two chapters later.
ContentsFifteen Problems
- 01Tic-Tac-ToeO(1) win detection via signed running sums per row, column and diagonal, generalized past 3x3.Easy
- 02Vending MachineThe canonical State pattern: Idle, HasMoney and Dispensing, and a context that delegates every call.Easy
- 03Snake & LadderUnifying snakes and ladders into one Jump concept, plus a pluggable Dice strategy.Easy
- 04ATM MachineA session State machine wired to a Chain of Responsibility cash dispenser, largest note first.Easy
- 05Logging FrameworkPluggable sinks via Strategy and level filtering, plus an honest look at what production still needs.Easy
- 06Parking LotThe single most-asked LLD question: multi-floor spots, tickets, fees, and where Strategy and a Factory belong.Medium
- 07Elevator SystemPer-car State machines, hall vs. cabin requests, and a pluggable SCAN dispatch strategy.Medium
- 08SplitwiseEQUAL, EXACT and PERCENT splits behind one Strategy, a pairwise balance sheet, and debt simplification.Medium
- 09LRU CacheO(1) get/put via a hashmap plus doubly-linked list, with eviction policy left pluggable.Medium
- 10BookMyShowCity to Theatre to Screen to Show to Seat, and the atomic seat-lock-with-timeout at the center of it.Medium
- 11ChessPolymorphic per-piece move rules, check and checkmate detection, and undo/redo via Command.Hard
- 12Ride-SharingThree state machines (rider, driver, trip), atomic matching, and pluggable surge pricing.Hard
- 13Food DeliveryOne order lifecycle, three actors watching it, and a pluggable delivery-partner assignment strategy.Hard
- 14Rate LimiterToken Bucket, Leaky Bucket, Fixed Window and Sliding Window behind one Strategy and a Factory.Hard
- 15Message Queue / Pub-SubA mini-Kafka in memory: topics, broadcast vs. consumer groups, per-consumer offsets, backpressure.Hard
Suggested OrderIf You're Short on Time
Reading front to back works, but if you only have a week: Vending Machine → Parking Lot → LRU Cache → BookMyShow → Chess. That path hits State, the most-asked question outright, a pure data-structure design, real concurrency, and the deepest single-domain problem in the set — in increasing order of how many things have to be right at once.
Compiled July 2026 · Built for study, not for citation · All code is real, working C++ from the companion problem set.