7 problems
Study path

Object-oriented design

The low-level design round is its own kind of interview. Same hour, same whiteboard, a different skill from the coding round and from system design. Nobody asks you to sort an array or to shard a database. Instead you take a small, concrete problem — a parking lot, a vending machine, an LRU cache — and turn it into classes: name the right entities, draw the relationships, model the state machine, and say out loud which edge cases you would handle. The seven pages below each work one problem the way a strong candidate would in 45 minutes — the requirements, the classes, the interfaces, the watch-outs — so you can practise the shape of the answer, not just the trivia.


The seven problems

Pick one and try to design it before you read the answer.

Each page is roughly 15–20 minutes of careful reading — the requirements, the class diagram, the interfaces, and the edge cases that catch most candidates.

  1. 01 Data structure

    LRU cache

    Constant-time get and put with capacity eviction. The interview classic — hash map plus doubly-linked list.

  2. 02 Entity modelling

    Parking lot

    Multi-level lot, mixed vehicle sizes, ticketing. Tests entity modelling, polymorphism, the assign-a-spot algorithm.

  3. 03 Composition

    Deck of cards

    Card / Deck / Hand / Game. Tests enums, generics, shuffle/deal, and how to compose pluggable games on top.

  4. 04 Data structure

    Hash map

    Bucket array plus collision chains. Tests memory layout, load factor, the rehash algorithm.

  5. 05 Chain of responsibility

    Call center

    Fresher → TL → Manager → Director escalation. Tests responsibility chains and skill-based routing.

  6. 06 Observers

    Chat server

    Users, rooms, messages, presence. Tests observers, threading, persistence boundaries.

  7. 07 State machine

    Vending machine

    Insert coin → select item → dispense. Tests the state-machine pattern in its purest form.

The rubric

What an interviewer is actually marking.

Entity naming

Are the classes right? Did you spot the implicit objects hiding in the problem statement?

Single responsibility

Each class does one thing. ParkingLot should not also model Payment.

Open / closed

Adding a vehicle type or a card suit should extend the design, not edit existing classes.

Polymorphism over type checks

Long chains of isinstance checks signal a missing base class or interface.

State explicit

If a thing has states, draw the state machine. "It runs unless it doesn't" is not a state machine.

Concurrency on the page

Naming where threads contend matters more than a flawless lock. "One lock here; per-shard in production" is usually enough.

Where this connects

OOD doesn't sit on its own.

The design patterns you reach for here — state machine, observer, chain of responsibility — come straight from the patterns catalogue. And the moment you zoom out from "classes inside one service" to "services across a network", you're in system design. These two are the natural pages to read alongside this one.