Skip to content

title: LLD problems description: Thirty-six machine-coding problems solved the interview way: requirements, entities, class and sequence diagrams, then a complete tested Python package.


LLD problems

Thirty-six machine-coding problems, each solved the way you would in a 45-minute round: requirements and assumptions, entities, a classDiagram, the key flows, then a complete, tested Python package under code/lld/ with an injected clock, explicit locking and a runnable demo. Start with the P0 problems - parking lot, elevator, vending machine, in-memory cache, rate limiter, tic-tac-toe, Splitwise and movie ticket booking - which together exercise every pattern and concurrency idea the rest reuse. Each page closes with the follow-ups interviewers ask and a pacing table for that specific problem.

Tiers: P0 must be solid before any interview, P1 is expected of a strong SDE2, P2 is stretch material for when the rest is done.

Start here (P0)

All pages

# Page Tier Covers
1 Design a parking lot P0 multiple floors; spot types (motorcycle, compact, large, EV, handicapped); vehicle types; entry gate issues a ticket and assigns the…
2 Design an elevator system P0 N cars and M floors; hall calls (up, down) and cabin requests; dispatch selects a car; movement with door open/close and capacity…
3 Design a vending machine (and a coffee machine) P0 products with price and quantity per slot; insert coins and notes; select a product; dispense and return change (greedy change-making…
4 Design a library management system P1 catalog of books with multiple barcoded copies; members and librarians; search by title, author, ISBN, subject; checkout limits (max 5…
5 Design an in-memory cache (LRU, LFU, TTL) P0 O(1) get and put; capacity eviction; LRU (dict + doubly linked list); LFU (frequency buckets, O(1)); per-key TTL with lazy expiry and an…
6 Design a rate limiter (LLD) P0 per-client keys (user, API key, IP); algorithms token bucket, fixed window, sliding log, sliding counter; rules per endpoint; allow or deny…
7 Design tic-tac-toe (an extensible board game) P0 N x N board (default 3); two players (human or bot); alternate turns; move validation; O(1) win detection via row, column and diagonal…
8 Design chess P1 standard setup; legal move generation per piece; turn enforcement; check, checkmate, stalemate; captures; castling and promotion (en…
9 Design snake and ladder P1 N x N board with snakes and ladders; 2+ players; dice strategy (fair, loaded, multiple dice); turn queue; exact-finish rule configuration…
10 Design the snake game P2 grid W x H; snake moves per tick; food spawns on a free cell; growth and score; wall and self collision ends the game; direction change…
11 Design Splitwise P0 users and groups; add an expense with payer(s) and a split (equal, exact, percent, shares) with validation; per-user balances (group and…
12 Design a movie ticket booking system (BookMyShow) P0 cities -> cinemas -> screens -> shows; browse and search; seat map with types and prices; select seats -> hold (10 min) -> pay -> confirm…
13 Design a hotel management system P1 rooms (type, number, status); availability by date range and type; reservation with guest; check-in and check-out; seasonal pricing…
14 Design an ATM P1 card and PIN (3 attempts then block); account selection; balance; withdrawal with daily limit and denomination dispensing; deposit…
15 Design a stock brokerage system P1 accounts with cash and portfolio; watchlists; price feed; market and limit buy and sell orders; validation (funds, holdings); order…
16 Design a car rental system P1 branches; vehicles (type, plate, status); search by location, dates, type; reservation with pickup and drop-off; pricing (daily, weekly…
17 Design a logging framework P1 levels with threshold filtering; handlers (console, file, rotating file, in-memory, remote stub); formatters (plain, JSON); logger…
18 Design an in-memory pub/sub message queue P1 topics (optional partitions); publish; subscribe; push delivery per subscriber; consumer groups; offsets and replay; at-least-once with…
19 Design a food delivery system (Swiggy, Zomato, DoorDash) P1 browse restaurants and menus by location; cart and order; restaurant accept or reject and prep; delivery-partner assignment (Strategy)…
20 Design Uber (LLD) with driver matching P1 ride request (pickup, drop, type); driver availability and location updates; matching (nearest, ETA, rating) with offer, accept, timeout…
21 Design Stack Overflow P1 users; questions (title, body, tags); answers; comments; votes with reputation rules; accept answer; search by keyword and tag; tags…
22 Design Amazon (cart, order, inventory, payment) P1 catalog with categories and search; cart (add, update, remove, guest merge); inventory per SKU per warehouse with reserve, commit, release…
23 Design Cricinfo (live scoreboard) P1 matches (teams, players, venue, format); ball-by-ball scoring (runs, wickets, extras, overs); innings, over and ball model; batting and…
24 Design a meeting scheduler and calendar P1 calendars; create meeting (time range, attendees, room, recurrence); conflict detection; find free slots for attendees in a window; rooms…
25 Design a traffic signal controller P1 intersection with N approaches; RED -> GREEN -> YELLOW cycles with durations; non-conflicting phases only; pedestrian request; emergency…
26 Design a text editor with undo and redo P1 documents; insert and delete at cursor; cursor movement; selection; copy, cut, paste; undo and redo (capped); find and replace; formatting…
27 Design an in-memory file system P1 mkdir -p; create, write, append, read files; ls sorted; rm -r; mv and rename; cp; absolute path resolution (relative with cwd optional)…
28 Design LinkedIn (social network) P2 profiles (experience, education, skills); connection requests (send, accept, reject, withdraw); degrees via BFS (1st to 3rd); follow; posts…
29 Design a task scheduler (cron, LLD) P1 one-off, fixed-delay, fixed-rate, cron-like schedules; priorities; worker pool; cancel, pause, resume; retries with backoff; timeouts…
30 Design a payment gateway and digital wallet P1 wallets with Decimal or Money balance; add money via a payment method; P2P transfer; merchant payment; methods via PSP adapters (card, UPI…
31 Design a notification service (LLD) P1 send via email, SMS, push, in-app; templates with placeholders; preferences and opt-out; channel fallback; priorities; per-user rate limit…
32 Design an online auction P2 listings with start and reserve price and start and end time; bids above current plus increment; proxy auto-bidding up to a maximum…
33 Design a restaurant management system P2 tables with capacity and status; reservations and walk-in waitlist; seating; menu with sections and availability; orders per table with…
34 Design a learning management system P2 courses -> modules -> lessons (video, article, quiz); instructors publish; enrollment (free or paid, capacity, prerequisites); progress…
35 Design an in-memory key-value store with transactions P1 get, set, delete, exists; incr and decr; begin, commit, rollback with nesting; reads see own uncommitted writes; optional TTL; prefix scan…
36 Design a bowling alley P2 lanes with availability and reservation; 1 to 6 players per game; 10 frames with strike, spare and open frames and 10th-frame bonus rolls…