Low-level design

LLD interview questions

A low-level design interview is not a smaller system-design interview. You are asked to design one component in classes, methods and thread-safety, often in 45 minutes. Below is the method we use, the questions that come up most often, and ten worked solutions with code that was run.

What interviewers are actually grading

They want to see whether you can turn a vague prompt into a design you could hand to another engineer. That usually means:

  • Clarifying requirements and calling out what you are leaving out of scope.
  • A class diagram that shows relationships, not a pile of nouns.
  • A pattern used because it fits (Strategy for pricing, State for a session), not because you memorised a list.
  • A clear story for concurrency: what is shared, what is locked, what happens when two users book the last seat.
  • Honest complexity and follow-ups: "if we add reservations, I would change X."

If you skip straight to code, or you draw 20 classes and never write a method, you will run out of time. The opening LLD lesson and the HLD vs LLD article go into the difference in more detail.

A 45-minute method

  1. Requirements (8–10 minutes). Actors, use cases, constraints. For a parking lot: vehicle types, payment, one entry or many, do spots have to be reserved? Write the functional list and two or three non-functionals (latency does not matter here; thread safety and extensibility do).
  2. Nouns and relationships (5 minutes). ParkingLot, Floor, Spot, Ticket, Vehicle, PricingStrategy. Prefer composition: a lot has floors, a floor has spots. Inheritance is for kinds of vehicle or kinds of spot, not for everything.
  3. Class diagram (10 minutes). Multiplicity, the public methods, and which class owns which collection. If you cannot point to the object that allocates a spot, the diagram is not done. See OOP and UML.
  4. Patterns, where they earn their place (5 minutes). Strategy for "price can change," State for "the session has a legal sequence," Factory for "we construct different vehicles." Skip the pattern if a plain function would do. SOLID and the pattern lessons cover the usual set.
  5. The hard method or the race (10 minutes). Write one real method: allocate a spot, settle an expense, evict from the cache. Then say what you lock, and what goes wrong if you do not. The thread-safety lesson has a checklist for this part.
  6. Follow-ups (the rest). Multi-floor, EV spots, refunds, a second ATM cassette, a new split type. Good designs absorb a follow-up by adding a class or a strategy, not by rewriting the diagram.

Worked problems on this site

These ten case studies are in the low-level design course. Each one has requirements, a class diagram, the patterns used, and Java or Python code that was run.

  • Parking lot

    Spot types, allocation and pricing as strategies, thread-safe entry. A very common first LLD question.

  • Elevator system

    Hall and car calls, LOOK scheduling, a dispatcher when there is more than one car.

  • LRU cache

    Hash map plus doubly linked list, O(1) get and put. Also LeetCode 146, so it shows up in both coding and design rounds.

  • Vending machine

    State pattern: idle, has-money, sold-out, plus change and cancel.

  • Movie ticket booking (BookMyShow)

    Seat holds with expiry, all-or-nothing booking, no double booking under concurrency.

  • Tic-tac-toe

    N × N board, O(1) win check, undo, and a pluggable minimax bot.

  • Snake and ladder

    Validated board, injectable dice, exact-finish vs bounce-back, the three-sixes rule.

  • ATM

    Card-session states, a chain of cassettes for cash, idempotent debits and reversals.

  • Splitwise

    Equal, exact, percent and share splits, rounding to the last paise, and settle-up.

  • Library management system

    Titles vs copies, one hold queue per title, a hold shelf that expires, renewals and fines.

Foundations sit in front of the case studies: what LLD is, UML, SOLID, then creational, structural and behavioural patterns. If you want a longer prompt list after the course, use the LLD practice sheet.

Also asked, not yet fully worked here

These come up often in India and US loops. We are honest about the ones we have not published a full solution for yet.

Library management
Books, copies, members, reservations and fines. A straightforward CRUD-heavy design; we have not published a full worked solution yet.
Logger / rate-limited logger
Levels, appenders, and often a requirement to not drop messages under load. A common follow-up to concurrency questions.
Parking lot variants (multi-floor, EV, reservations)
Usually asked as follow-ups to the basic parking-lot design, not as a separate problem.
Chess or battleship
Board games test piece movement, turns and win detection. Tic-tac-toe and snake-and-ladder on this site cover the same habits.
Meeting scheduler / calendar
Interval overlap, finding a common slot, and sometimes recurring events.
Hotel booking or Amazon locker
Inventory plus time-bounded reservations, close to the ticket-booking design.

A compact example: LRU cache

LRU is the rare problem that appears in both coding rounds (LeetCode 146) and LLD rounds. The design is two structures: a hash map from key to node for O(1) lookup, and a doubly linked list from most- to least-recently used so you can move or evict a node in O(1). Sentinel head and tail nodes remove the empty-list special cases.

This is the same approach as the full LRU lesson, trimmed to the operations an interviewer usually asks you to write. It was run locally with capacity 2 against the standard LeetCode sequence.

class LRUCache:
    def __init__(self, capacity):
        self.capacity = capacity
        self.map = {}
        self.head, self.tail = Node(), Node()  # sentinels
        self.head.next, self.tail.prev = self.tail, self.head

    def get(self, key):
        node = self.map.get(key)
        if node is None:
            return -1
        self._unlink(node)
        self._push_front(node)  # mark most recently used
        return node.value

    def put(self, key, value):
        node = self.map.get(key)
        if node is not None:
            node.value = value
            self._unlink(node)
            self._push_front(node)
            return
        if len(self.map) == self.capacity:
            lru = self.tail.prev
            self._unlink(lru)
            del self.map[lru.key]
        node = Node(key, value)
        self.map[key] = node
        self._push_front(node)

put(1,1), put(2,2), get(1) → 1, put(3,3) evicts key 2, get(2) → -1, put(4,4) evicts key 1, get(1) → -1, get(3) → 3, get(4) → 4.

The usual follow-ups are thread safety (a lock around get and put, or a concurrent map plus careful list updates), LFU, and a TTL. Those are in the lesson, with Python and Java.

Common mistakes

  • Designing a distributed system. "Parking lot" is not "design Uber." No load balancer, no Kafka, no microservice diagram unless the interviewer asks for HLD.
  • Singleton everywhere, or a God class named Manager that owns all the state.
  • Inheritance trees for things that should be a strategy or a flag. A WeekendPricingStrategy is better than a WeekendParkingLot subclass.
  • Ignoring concurrency until the last two minutes, then waving at a lock. Say what is shared before you write the method.
  • Never writing a method. A diagram with no allocateSpot or settleUp is incomplete.
  • Memorising a GitHub solution and freezing when the follow-up is slightly different. Practise changing the design, not reciting it.

Frequently asked questions

What are LLD interview questions?

Low-level design questions ask you to design a single system in classes and methods, not a fleet of services. Typical prompts are "design a parking lot", "design an LRU cache" or "design Splitwise." Interviewers want to see requirements, a class diagram, the right patterns, and how you handle concurrency, not a cloud architecture.

How do I prepare for an LLD interview?

Learn a repeatable method first (requirements, nouns, class diagram, patterns, concurrency, then code), then work through 10–15 classic problems. The LLD course does that in order: what LLD is, UML, SOLID, the common patterns, then ten worked case studies with code that was run. Do not jump to parking lot before you can draw a class diagram.

What is the difference between LLD and HLD?

High-level design is the system: APIs, storage, caches, queues, estimates. Low-level design is the code structure of one service or component: classes, patterns, thread safety. The same product can be asked both ways; we walk through that in HLD vs LLD.

How long is an LLD interview?

Usually 45 to 60 minutes. A workable split is 8–10 minutes on requirements and use cases, 15 minutes on classes and relationships, 10 minutes on the trickiest method or a concurrency issue, and the rest on follow-ups. Running out of time because you coded too early is more common than running out because you asked too many questions.

Do I have to write compilable code?

It depends on the company. Some want a class diagram and method signatures on a whiteboard. Others (especially machine-coding rounds) want working code in a shared editor. Practise both: a diagram you can defend, and one or two problems written and run end to end, like the LRU cache below.

Which LLD questions are asked most often?

Parking lot, LRU cache, a ticket-booking or hotel system, elevator, vending machine, Splitwise, and a logger or rate limiter. Start with those. The ten worked problems in the course cover the first six of that list.