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.
| Title | Difficulty |
|---|---|
| Singleton Pattern How the Singleton pattern guarantees one instance, how to make lazy creation thread safe (locks, double-checked locking, the holder idiom), and why passing one instance in is usually better. | |
| State Pattern How the State pattern turns an object with modes into one class per state, with a vending machine example, an ATM walkthrough, transition tables for order lifecycles and when not to use it. | |
| Template Method Pattern How the Template Method pattern fixes the steps of an algorithm in a base class and lets subclasses fill in the parts that vary, with a board game loop, a job runner walkthrough, variations and when not to use it. | |
| Concurrency Fundamentals Threads, shared state and why races happen, the concurrency toolbox (atomics, locks, semaphores, condition variables, blocking queues) and the three kinds of concurrency questions. | |
| Async and Non-Blocking I/O Why one thread per connection stops scaling, how non-blocking sockets and selectors let one event loop serve thousands of clients, and how Node.js, Netty and async/await build on it. | |
| Classic Concurrency Problems The textbook synchronization puzzles interviewers still ask (bounded buffer, print in order, dining philosophers, readers-writers, the bathroom problem, the sleeping barber), what each one teaches and the standard fix. | |
| Concurrency vs Parallelism What concurrency and parallelism each mean, one photo-processing job solved both ways (threads for waiting, cores for computing), and how to tell which one a problem needs. | |
| Deadlocks, Livelocks and Starvation Why threads freeze waiting on each other, the four conditions behind every deadlock, and the fixes interviewers expect: lock ordering, tryLock with timeouts, and detecting cycles in a wait-for graph. | |
| Lock-Free Programming How compare-and-swap lets threads update shared data without locks, the CAS retry loop, a lock-free stack and queue, the ABA problem and its fixes, and when a plain lock is the better choice. | |
| Multithreading Patterns The reusable shapes of multithreaded code: thread pools and futures, fan-out/fan-in, read-write locks, immutability, thread confinement and double-checked locking, with when each one is worth it. | |
| Race Conditions, Locks and Atomics The two shapes of race condition (read-modify-write and check-then-act), how mutexes and atomics fix them, and a step-by-step recipe for making a class thread safe. | |
| Semaphores and Resource Pools How semaphores cap how many threads use something at once, how to build a bounded resource pool that blocks, times out or rejects, and how backpressure keeps a busy system from collapsing. | |
| The Actor Model Concurrency without shared state: actors that own their data and talk only through mailboxes, tell vs ask, running millions of actors on a few threads, and supervision trees that restart what crashes. | |
| Thread Coordination How threads wait for each other without wasting CPU: condition variables and wait/notify, producer-consumer with blocking queues, and latches and barriers for "wait until N things happen". | |
| Virtual Threads vs Platform Threads What an OS thread really costs, how Java's virtual threads and Go's goroutines make threads cheap enough to have one per task, and when that helps a high-concurrency service and when it doesn't. | |
| Design a Parking Lot Design a multi-level parking lot with spot sizes, fitting rules, tickets on entry, fees on exit through a swappable pricing strategy, and live availability counts. | Medium |
| Design Amazon Locker Design a self-service package locker with locker sizes, best-fit assignment, one-time pickup codes, a hold time after which packages expire, and a courier sweep that takes them back. | Medium |
| Design an Elevator System Design a multi-elevator controller that moves each car with the SCAN (LOOK) algorithm and dispatches every hall call to the car that would arrive first. | Medium |
| Design Chess Design a two-player chess game with piece movement rules, move validation that respects check, checkmate and stalemate detection, and a move history with undo. | Hard |
| Design Connect Four Design Connect Four with gravity drops through column heights, turn checks, wins in four directions found by walking out from the last disc, draws, and room for undo and other board sizes. | Easy |