Skip to the page

Design rounds · 23 concepts

Low-level design

How to run a low-level design round: classes and responsibilities, SOLID with real examples, the patterns interviews ask, thread-safe code and the classic problems.

Part 1 · 1 concept

Running the round

  1. 01

    How to run a low-level design round

    A low-level design round is about classes, responsibilities and working code for one small system. Run it in steps: clarify, list the entities, sketch the classes…

Part 2 · 7 concepts

OOP and SOLID

  1. 02

    The four pillars with a real example

    Encapsulation protects the rules of an object, abstraction hides how behind a simple interface, inheritance shares behaviour carefully, and polymorphism runs different…

  2. 03

    Single responsibility principle

    A class should have one reason to change. A class that calculates tax, renders a PDF, saves to the database and sends email has four reasons to change and cannot be…

  3. 04

    Open-closed principle

    Add new behaviour by adding new classes, not by editing old code. A payment method with an if/else for every type should become one handler class per type behind an…

  4. 05

    Liskov substitution principle

    Code written for a parent type must work with every subclass. A subclass that throws when the parent promises to work, such as a FixedDeposit that refuses withdraw…

  5. 06

    Interface segregation principle

    Clients should not depend on methods they do not use. A fat PaymentMethod interface with refund, EMI and auto-pay forces cash on delivery to fill methods with…

  6. 07

    Dependency inversion and injection

    High-level logic should depend on abstractions, not on concrete classes it creates itself. Pass dependencies in through the constructor so tests can use fakes.

  7. 08

    Inheritance, composition and interfaces

    Inheritance multiplies classes when behaviour varies in several ways. Composition holds the varying parts as objects and combines them at run time. Choose interface or…

Part 3 · 5 concepts

Design patterns

  1. 09

    Strategy pattern for changing rules

    Strategy puts each rule in its own class behind one interface, so the code that uses the rule does not change. It is the answer to fare rules, pricing, allocation order…

  2. 10

    Factory, builder and singleton

    A factory moves object creation out of business code. A builder makes objects with many optional fields readable and safe. A singleton means one instance, but a global…

  3. 11

    Observer and domain events

    Observer lets one action tell many listeners without knowing them. When placeOrder keeps growing side effects, publish an OrderPlaced event and let listeners react…

  4. 12

    Decorator and adapter

    An adapter translates a vendor interface into one you own. A decorator wraps the same interface to add retries, timeouts and logging. Together they let you change…

  5. 13

    State pattern or transition table

    A lifecycle such as an order or a vending machine is a state machine. Use a transition table when the main rule is which move is allowed, and the State pattern when…

Part 4 · 5 concepts

Concurrency in LLD

  1. 14

    Race conditions and atomic updates

    A race happens when two threads read, check and write shared data in separate steps. A thread-safe map is not enough. Make the whole read-check-write one atomic step.

  2. 15

    Booking seats and stock without double booking

    Checking availability and taking the item must be one atomic step. Lock or update only the seats or products involved, in a fixed order, and give holds an expiry…

  3. 16

    Producer-consumer and blocking queues

    A producer-consumer queue needs waiting and waking done right. Use a while loop around the wait condition, wake the right side, or better, use a ready-made blocking…

  4. 17

    Deadlock and lock ordering

    A deadlock happens when threads hold locks and wait for each other in a cycle. The fix is to always take locks in one global order.

  5. 18

    Idempotency: a retry must not charge twice

    A timeout does not mean failure. Give every charge an idempotency key stored under a unique constraint, so a retry returns the stored result and never creates a second…

Part 5 · 5 concepts

Classic problems

  1. 19

    Parking lot, library and board games

    These are the most common starter problems. They test whether you can turn rules into small classes, keep lookups fast and make new rules cheap: a parking lot, a…

  2. 20

    Splitwise, vending machine and ATM

    These problems are about money rules and machine states. Keep money exact, validate inputs, check before taking money, and model the machine as a state machine with a…

  3. 21

    Cache, key-value store, rate limiter and logger

    These problems are data structures plus concurrency. Know LRU with a map and a doubly linked list, expiry with a clock, the rate limit algorithms, and a fast logging…

  4. 22

    Elevator, cab booking and food delivery

    These problems have many actors acting at the same time. Use a dispatch Strategy to choose, a state machine for the lifecycle, and an atomic claim so one driver or lift…

  5. 23

    Notification service, task scheduler and pub-sub

    These problems are small systems with queues and worker threads. Each has a clear flow, retries with backoff, a dead-letter path, and idempotent consumers. Never block…

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview