17 graded code design problems
Low-Level Design (LLD) interview problems
Practise object-oriented design and machine coding interviews. Write real TypeScript classes against a clean interface, pass hidden edge-case tests, then adapt your design to a realistic change request.
Start with the worked example
All low-level design problems (16)
Design Parking Lot
Park vehicles in the right size of spot, issue tickets and charge on exit.
Modelling objects, matching rules and a pricing policy
Design Tic-Tac-Toe (N × N)
Any board size, with a win check that only looks around the last move.
Checking only what a move can change
Design Vending Machine
Take coins, sell products, give change, and refuse what a state does not allow.
States and the actions each state allows
Design Snake and Ladder
A board game where the board, the players and the rules for a turn are separate pieces.
Separating the board, the players and the turn rules
Design Library System
Lend books to students and faculty with different limits, and charge fines for late returns.
Policies that differ by member type
Design LRU Cache
A fixed-size cache that throws out the least recently used entry when full, with every operation in constant time.
Choosing data structures for constant-time operations
Design Rate Limiter
Two rate-limiting algorithms behind one interface, so callers can swap them.
One interface, several algorithms
Design Game Leaderboard
Add points, show the top players and anyone's rank, with ties handled consistently.
Ranking with ties, and keeping reads cheap
Design Key-Value Store with Expiry
An in-memory store with per-key expiry, later with nested transactions.
Time-based expiry, then layered transactions
Design Expense Sharing (Splitwise)
Split shared expenses several ways, track who owes whom, and suggest the fewest payments to settle up.
Strategies for one operation, and exact money in whole cents
Design Digital Wallet
Deposits, withdrawals and transfers that are safe to retry, with a full history.
Idempotent money operations and a ledger
Design Movie Ticket Booking
Hold seats for a few minutes, confirm or release them, and never sell one seat twice.
Temporary holds that expire, and seat state
Design Calendar Scheduling
Book meetings without double-booking anyone, and find free time for a group.
Interval logic: overlaps, merging and gaps
Design Job Scheduler
Run jobs when they are due, in a fixed order, with cancelling and (later) repeating jobs.
Priority queues and a clock you control
Design Elevator System
Several elevators answering hall calls, moving one floor per step and serving stops in their direction of travel.
A dispatch strategy and a step-by-step state machine
Design Chess Move Rules
Generate and play legal piece moves, with each kind of piece owning its own movement.
Polymorphism: each piece knows how it moves