Skip to the chapters

Low-level design (LLD)

Classes, design patterns and concurrency, with 27 mock interviews and runnable code in Java, JavaScript and Python.

110 topics · 27 mock interviews · 16 chapters

Start reading

The start of every guide is free, with no sign-up.

Chapter 1

How the LLD round works

35 pages
  1. What the LLD round is and what interviewers score Beginner 6 pages
  2. Three formats: the design talk, machine coding and concurrency coding Beginner 6 pages
  3. Junior, mid-level and senior answers to the same question Intermediate 6 pages
  4. How the round differs by company: Amazon, Google, Microsoft, Uber, Atlassian, Rubrik, Flipkart, Swiggy, PhonePe and Razorpay Beginner 6 pages
  5. Talking while you design: explaining classes, taking hints and defending choices Beginner 6 pages
  6. Red flags: what gets candidates rejected in LLD Beginner 5 pages
Chapter 2

The framework

51 pages
  1. The LLD framework: six steps for every question Beginner 6 pages
  2. Step 1: Clarify the requirements and cut the scope Beginner 5 pages
  3. Step 2: Find the entities and how they relate Beginner 6 pages
  4. Step 3: Draw the class diagram (just enough UML) Beginner 6 pages
  5. Step 4: Define the interfaces and method signatures Beginner 6 pages
  6. Step 5: Code the core flow first Intermediate 6 pages
  7. Step 6: Extend it, test it and handle the edge cases Intermediate 6 pages
  8. The framework end to end: tic-tac-toe in 40 minutes Beginner 7 pages
  9. Practice: The round and the framework 3 pages
Chapter 3

Object-oriented building blocks

57 pages
  1. Classes, objects and the state they own Beginner 6 pages
  2. Encapsulation: hiding state behind methods Beginner 6 pages
  3. Abstraction and interfaces Beginner 6 pages
  4. Inheritance, and when it goes wrong Beginner 6 pages
  5. Polymorphism: one call, many behaviours Beginner 6 pages
  6. Composition over inheritance Intermediate 6 pages
  7. How classes relate: association, aggregation, composition and dependency Beginner 6 pages
  8. Enums, value objects and immutability Intermediate 6 pages
  9. Errors in a design: validation, exceptions and result types Intermediate 6 pages
  10. Practice: Object-oriented building blocks 3 pages
Chapter 4

Design principles

51 pages
  1. Single responsibility and cohesion Beginner 6 pages
  2. Open/closed: adding features without editing old code Intermediate 6 pages
  3. Liskov substitution: subclasses that keep their promises Intermediate 6 pages
  4. Interface segregation: small, focused interfaces Intermediate 6 pages
  5. Dependency inversion and dependency injection Intermediate 6 pages
  6. Coupling and the Law of Demeter Intermediate 6 pages
  7. DRY, KISS and YAGNI: when simple beats clever Beginner 6 pages
  8. Designing for testability Intermediate 6 pages
  9. Practice: Design principles 3 pages
Chapter 5

Design patterns: creating and structuring objects

66 pages
  1. Design patterns in the interview: how to use them, and when not to Beginner 7 pages
  2. Singleton, and why interviewers distrust it Beginner 7 pages
  3. Factory method and simple factory Beginner 7 pages
  4. Abstract factory Intermediate 7 pages
  5. Builder Beginner 7 pages
  6. Adapter Beginner 7 pages
  7. Decorator Intermediate 7 pages
  8. Facade and proxy Intermediate 7 pages
  9. Composite Intermediate 7 pages
  10. Practice: Creating and structuring objects 3 pages
Chapter 6

Design patterns: behaviour

66 pages
  1. Strategy Beginner 7 pages
  2. Observer Beginner 7 pages
  3. State Intermediate 7 pages
  4. Command, and how it gives you undo Intermediate 7 pages
  5. Chain of responsibility Intermediate 7 pages
  6. Template method Beginner 7 pages
  7. Iterator and visitor Advanced 7 pages
  8. The rarer patterns in brief: prototype, bridge, flyweight, mediator and memento Intermediate 7 pages
  9. Telling look-alike patterns apart: strategy vs state, decorator vs proxy, factory vs builder Intermediate 7 pages
  10. Practice: Behaviour patterns 3 pages
Chapter 7

Modelling patterns: the moves LLD questions repeat

66 pages
  1. Modelling a lifecycle with a state machine: orders, elevators, vending machines Intermediate 7 pages
  2. Allocating scarce things: spots, seats, rooms and slots Intermediate 7 pages
  3. Prices, fees and rules that keep changing Intermediate 7 pages
  4. Money, time and IDs in code: money types, injected clocks and ID generators Intermediate 7 pages
  5. Storing data in memory: repositories, indexes and lookups Beginner 7 pages
  6. Events and notifications inside one program Intermediate 7 pages
  7. Undo, redo and history Intermediate 7 pages
  8. Modelling games: boards, turns, players and rules Beginner 7 pages
  9. Searching and filtering in memory: indexes and composable filters Intermediate 7 pages
  10. Practice: Modelling patterns 3 pages
Chapter 8

Concurrency in LLD

58 pages
  1. Threads, shared state and race conditions Beginner 6 pages
  2. Locks and critical sections Intermediate 6 pages
  3. Check-then-act: making booking and allocation safe Intermediate 6 pages
  4. Deadlocks, livelocks and starvation Intermediate 6 pages
  5. Atomics and compare-and-swap Intermediate 6 pages
  6. Thread-safe collections and read-write locks Intermediate 6 pages
  7. Producer–consumer and blocking queues Intermediate 7 pages
  8. Thread pools, executors and futures Intermediate 6 pages
  9. Making a class thread-safe: confinement, immutability and a locking plan Advanced 6 pages
  10. Practice: Concurrency 3 pages
Chapter 9

The machine-coding round

40 pages
  1. The machine-coding round: format, rules and how it is marked Beginner 7 pages
  2. A 90-minute plan: what to build first, and what to leave out Intermediate 6 pages
  3. Project layout, naming and a driver you can demo Beginner 7 pages
  4. Writing tests fast: the cases that catch bugs Intermediate 7 pages
  5. When the interviewer adds a requirement halfway through Intermediate 7 pages
  6. The review after: walking through and defending your code Intermediate 6 pages
Chapter 10

Case studies: the classics

58 pages
  1. Design a parking lot Beginner 12 pages
  2. Design an elevator system Intermediate 12 pages
  3. Design a vending machine Beginner 11 pages
  4. Design an ATM Intermediate 12 pages
  5. Design a library management system Beginner 11 pages
Chapter 11

Case studies: games

34 pages
  1. Design snake and ladder Beginner 11 pages
  2. Design 2048 Intermediate 11 pages
  3. Design a chess game: moves, rules and a move validator Advanced 12 pages
Chapter 12

Case studies: bookings, commerce and money

77 pages
  1. Design movie ticket booking (like BookMyShow or Fandango) Intermediate 11 pages
  2. Design expense sharing (like Splitwise) Intermediate 11 pages
  3. Design parcel lockers (like Amazon Locker) Intermediate 11 pages
  4. Design food ordering (like DoorDash or Swiggy) Intermediate 11 pages
  5. Design cab booking (like Uber) Advanced 11 pages
  6. Design an inventory and order management system Advanced 11 pages
  7. Design a digital wallet Advanced 11 pages
Chapter 13

Case studies: building blocks in code

88 pages
  1. Design an LRU cache Intermediate 11 pages
  2. Design a rate limiter Intermediate 11 pages
  3. Design a logging framework Beginner 11 pages
  4. Design a pub/sub message broker Intermediate 11 pages
  5. Design a key-value store with transactions Advanced 11 pages
  6. Design a task scheduler Advanced 11 pages
  7. Design an in-memory file system Intermediate 11 pages
  8. Design a notification service Intermediate 11 pages
Chapter 14

Case studies: apps and tools

44 pages
  1. Design a task board (like Trello or Jira) Intermediate 11 pages
  2. Design meeting rooms and calendar Intermediate 11 pages
  3. Design a Q&A site (like Stack Overflow) Intermediate 11 pages
  4. Design a spreadsheet (like Google Sheets) Advanced 11 pages
Chapter 15

Practice problems

61 pages
  1. Problem set: games (Connect Four, Minesweeper, a deck of cards with Blackjack, Sudoku) 11 pages
  2. Problem set: bookings and commerce (car rental, hotel booking, a coupon and discount engine, a shopping cart with checkout) 11 pages
  3. Problem set: building blocks (a thread pool, a circuit breaker, a URL shortener in code, a feature-flag service) 11 pages
  4. Problem set: apps (a live sports scoreboard, a music playlist with shuffle and repeat, a chat room, a mini Twitter) 11 pages
  5. Follow-up drills: "add a new type", "make it thread-safe", "now save it to disk" 11 pages
  6. Running an LLD mock round: timer, marking sheet and feedback 6 pages
Chapter 16

Revision

19 pages
  1. The LLD cheat sheet: principles, patterns and concurrency tools 4 pages
  2. Every case study in five lines 9 pages
  3. Patterns at a glance: which pattern solves which problem 4 pages
  4. The night before the LLD round 2 pages

More to read

Mobile, Frontend, ML and GenAI system design are being written.