Classic LLD problems

LLD classics index

Full Lattice index of classic LLD deep dives — every walkthrough linked, a recommended practice order, and the concurrency note interviewers poke per classic.

How to use this index

This page is a map. Curriculum splits classics into occupancy & quotas, booking & inventory, games, and logger & filesystem — same themes as below.

  1. Pick one deep dive from the practice order (don’t randomize).
  2. Timer 35 minutes: clarify → model → code mutation → race.
  3. Only then open complete-solution / concurrency-cases.
  4. Hubs (parking/limiter/elevator etc.) are optional revision packs.

Every classic deep dive

01Core

Lot · Lift · Limiter

02Commerce

Tickets · Stock · Locker · Library

03Systems

FS · Logs · Games

04Cadence

One classic / day × 35 min

This hub is the index, not a second textbook. Pick a deep dive, lock a 35-minute timer, talk out loud.

Order to practice

Don’t shuffle randomly. Build muscles in this order so each classic reuses the previous narration skeleton.

  1. Week spine — Core. Parking → Rate limiter → Elevator. Occupancy → quotas → simulation.
  2. Commerce week. Movie booking → BookMyShow → Inventory → Locker → Library. All share FREE → HELD(TTL) → COMMITTED.
  3. Systems week. Filesystem → Logger → Tic Tac Toe → Connect Four → Chess (stretch).
  4. Always open with delivery framework for the 35-minute talk track.

Concurrency note per classic

Volunteer one concurrency sentence before they ask. Link back to concurrency basics → correctness when you need the toolkit.

  • Parking lot — One lot lock around enter/exit — last-spot race is the classic poke. (solution · concurrency when present)
  • Rate limiter — Per-key lock on refill+consume; never one global lock for all keys. (solution · concurrency when present)
  • Elevator — Enqueue requests under a lock; step() owns the car state single-threaded. (solution · concurrency when present)
  • BookMyShow — Seat hold must be atomic + TTL; two bookers on one seat = one win. (solution · concurrency when present)
  • Movie ticket booking — Same scarce-seat race as BookMyShow — name the claim/commit/release path. (solution · concurrency when present)
  • Inventory management — Atomic reserve/transfer so stock never goes negative under two writers. (solution · concurrency when present)
  • Amazon Locker — Assign bay under lock; expired reclaim vs pickup race needs clear owner. (solution · concurrency when present)
  • Book library — Checkout last copy + reservation queue — serialize claim of a BookItem. (solution · concurrency when present)
  • In-memory filesystem — Tree lock (or ordered path locks) on mutate; move must not race mkdir. (solution · concurrency when present)
  • Logger — Per-destination (or per-sink) lock; don’t hold while formatting if async. (solution · concurrency when present)
  • Connect Four — Usually single-player turn lock; if dual clients, serialize makeMove on Game. (solution · concurrency when present)
  • Tic Tac Toe — Turn ownership is the race — reject move if not your turn under one lock. (solution · concurrency when present)
  • Chess game — Same as games: one move at a time; clock/timer is a separate actor if asked. (solution · concurrency when present)

How to practice

← Lattice