Low-level design
Object-oriented design for interviews: the framework, design principles and patterns, concurrency, and problem breakdowns you can practice in the code runner.
Object-oriented design for interviews: the framework, design principles and patterns, concurrency, and problem breakdowns you can practice in the code runner.
118 write-ups
| Title | Difficulty |
|---|---|
| Design Browser History Design the back and forward buttons of a browser tab: visit clears forward pages, back and forward move several steps at once, built from one stack to two stacks to an array with a cursor. | Easy |
| Design Concurrent Bank Transfers Design a bank where many threads move money between accounts at once, with per-account locks taken in a fixed order so transfers never deadlock and the total is always conserved. | Medium |
| Design Dining Philosophers Let n philosophers share n forks with no deadlock and no starvation, from why "left fork first" gets stuck to a fair waiter that hands out both forks at once. | Medium |
| Design Game Matchmaking Design a matchmaker that groups players by mode (1v1, 2v2, 4v4), region and level, joins an open lobby or creates one, starts full games and splits them into balanced teams. | Medium |
| Design Minesweeper Design Minesweeper: mine placement kept outside the game, neighbor counts, flood reveal with a queue, flags, and win or lose detection with a counter instead of a board scan. | Easy |
| Design Movie Ticket Booking Design a BookMyShow-style booking system with shows, seat maps, temporary seat holds that expire, confirm and cancel, and safe booking when many users want the same seat. | Medium |
| Design Nested Comments Design a Reddit-style comment tree with replies at any depth, votes, soft deletes, top/new/old sorting at every level, eager versus lazy loading with "load more" markers, and word search. | Medium |
| Design Pastebin Design a paste service with short shareable ids, expiry times, public, unlisted and private visibility, owner-only delete and a list of recent public pastes. | Easy |
| Design Search Autocomplete Design a search box that suggests the three most popular past sentences for what the user has typed so far, from a full scan to a trie to a trie that caches each prefix's top three. | Medium |
| Design Snake Game Design the classic Snake game on a grid: a body stored as a queue plus a set, food that appears one piece at a time, growth, wall and self collisions, and the score after every move. | Easy |
| Design Snakes and Ladders Design Snakes and Ladders with one jump map for snakes and ladders, an injected dice strategy, turn order for any number of players, extra turns on a six, and exact landing on the last cell. | Easy |
| Design Splitwise Design an expense-sharing app with equal, exact and percent splits, fair rounding of cents, pairwise balances that net out, settle-ups, and a greedy plan that simplifies everyone's debts. | Medium |
| Design Stack Overflow Design a Q&A site with questions, answers and tags, one vote per user per post, accepted answers, reputation that stays correct when votes change, ranked answers and tag search. | Medium |
| Design Tetris Design Tetris with seven piece shapes, rotation that stays in place, collision checks, gravity and locking, line clears with scoring, and a game loop that keeps time out of the rules. | Medium |
| Design the Sleeping Barber Design a thread-safe barbershop where the barber sleeps when nobody waits, arriving customers take a waiting chair or leave when the shop is full, and each customer waits for their own haircut. | Medium |
| Design the Unisex Bathroom Design a thread-safe shared bathroom that holds one gender at a time, never more than its capacity, and lets everyone in eventually, using a lock, a condition variable and a ticket line. | Medium |
| Implement a Promise / Future Build a thread-safe promise that settles once, wakes blocked readers with timeouts, runs then-callbacks exactly once, and combines results with allOf and anyOf, like a small CompletableFuture. | Medium |
| Implement a Read-Write Lock Build a read-write lock from a mutex and a condition variable, with writer preference so writers never starve, try methods, and the upgrade, reentrancy and fairness follow-ups. | Medium |