Classic LLD Case Studies
Practise the most frequently asked designs: parking lot, library management, vending machine, tic-tac-toe or snake and ladder, and an elevator system.
Intermediate · about 12 hours · difficulty 3/5
Learn first: How to Approach an LLD Interview
A small set of prompts covers most LLD interviews. Designing each one yourself, then comparing with reference solutions, teaches you reusable building blocks.
The core set and what each teaches
- Parking lot: entity modelling, Strategy for spot allocation and pricing, concurrency on spot assignment, and the Factory pattern for vehicles.
- Library management: users, books vs book copies (a key distinction), reservations, fines, and search. Teaches separating a catalogue item from a physical item.
- Vending machine or ATM: the State pattern (Idle, HasMoney, Dispensing) and Chain of Responsibility for dispensing notes.
- Tic-tac-toe, Snake and Ladder, Chess: game loops, board and player abstractions, win checking, and keeping rules separate from the board so you can change them. Chess adds per-piece movement via polymorphism.
- Elevator system: request scheduling (a SCAN-like algorithm, which you saw in disk scheduling), states per elevator, and a controller that assigns requests. Great for showing Strategy and State together.
- Logger or notification service: Chain of Responsibility for levels, Observer for subscribers, Singleton for the logger instance.
How to practise each one
- Timebox 45 minutes: requirements, class diagram, then code the core classes and one flow.
- Compare with a reference solution and note differences in responsibilities, not naming.
- Revisit a week later and add one extension (EV charging, multiple elevators, undo in games).
What interviewers look for
Clear single-responsibility classes, interfaces at the points of change, correct relationships, and working code for at least the main flow.
Good enough to move on: you can design and partially code any three of these from a blank page within the time limit, and explain the pattern choices.
Key concepts
- Parking lot
- Library management system
- Vending machine and ATM
- Tic-tac-toe and Snake and Ladder
- Elevator system
- Logger and notification service
- Chess
Mini project
Implement a working parking lot and an elevator system in your DSA language with a simple CLI: multiple floors and spot types, pluggable pricing, and an elevator controller that serves requests using a SCAN-style strategy, with unit tests for the core flows.
Check yourself
In a library system, why should Book and BookItem be separate classes, and which one does a reservation reference?