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.
35 write-ups
| Title | Difficulty |
|---|---|
| Build a Semaphore, Latch and Barrier Build a counting semaphore, a countdown latch and a reusable barrier from one lock and a condition variable, and learn the wait loop behind every blocking primitive. | Medium |
| Design a Bounded Blocking Queue Design a fixed-size FIFO queue that makes producers wait when it is full and consumers wait when it is empty, built from one lock and two condition variables. | Medium |
| Design a Circuit Breaker Design a circuit breaker that fails fast when a dependency is down: closed, open and half-open states, failure and success thresholds, a lazy timeout, and safe use from many threads. | Medium |
| Design a Connection Pool Design a database connection pool with a size limit, callers that wait in line with a timeout, idle timeouts, dead connections dropped and replaced, and a thread-safe version. | Medium |
| Design a Deadlock Detector Design a lock manager that builds a wait-for graph, detects a deadlock the moment it forms, picks a victim to abort, and hands its locks to the next waiters, safely across threads. | Medium |
| Design a Delayed Task Scheduler Design a ScheduledExecutor-style scheduler: a delay queue ordered by due time, one timer thread that sleeps until the next task, cancellation and fixed-rate repeats. | Medium |
| Design a Digital Wallet Design a Venmo-style wallet with deposits, withdrawals and instant P2P transfers, recorded in an append-only double-entry ledger with statements, refunds and safe concurrent transfers. | Medium |
| Design a Job Scheduler Design a job scheduler that runs immediate, one-off and recurring jobs on a fixed worker pool, with an event loop over timers, clear status tracking, cancellation and room for cron schedules. | Medium |
| Design a Leaderboard Design a game leaderboard that adds points to players, sums the top K totals and resets players, from sorting on every read to a heap to an always-sorted score index, plus ranks, daily boards and scale. | Medium |
| Design a Loading Cache Design a thread-safe cache that loads missing values through a loader, runs one load per key when many threads miss at once, expires entries after a TTL, and never caches failures. | Medium |
| Design a Logging Framework Design a logging framework with levels, appenders and formatters, an async bounded buffer with backpressure policies and flush, and an audit trail that never loses an entry. | Medium |
| Design a Multi-Stage Pipeline Design an in-process pipeline whose stages run on their own threads, joined by bounded queues for backpressure, with a poison-pill shutdown that finishes every accepted item. | Medium |
| Design a Multithreaded Download Manager Design a download manager that splits files into chunks fetched in parallel by a worker pool, retries failed chunks, supports pause and resume, and reports progress safely across threads. | Medium |
| Design a Multithreaded Web Crawler Design a crawler that follows links on one host with a pool of worker threads, a shared frontier and visited set, robots rules, and a correct way to know when the crawl is done. | Medium |
| Design a Notification Service Design a multi-tenant notification service with per-tenant templates, email/SMS/push channels, a priority queue drained by workers, and retries with exponential backoff. | Medium |
| Design a Parallel Merge Sort Design a fork/join engine on a fixed thread pool that runs a parallel merge sort and a parallel sum, avoids pool-starvation deadlock, and knows when splitting stops paying off. | Medium |
| Design a Pub/Sub System Design an in-memory publish/subscribe broker with topics, a bounded inbox per subscriber, a drop-oldest policy for slow readers, and async delivery by dispatcher threads. | Medium |
| Design a Rate Limiter Design an in-process rate limiter with per-client limits and pluggable fixed window, sliding window and token bucket algorithms, then make it safe for many threads. | Medium |
| Design a Request Batcher Design a request batcher that groups calls from many threads into one backend call, flushes when a batch is full or its time window ends, and hands every caller its own result. | Medium |
| Design a Rule Engine Design a fraud rule engine for card payments, with conditions composed from AND, OR and NOT, velocity rules, the most severe action winning, and safe rule changes under concurrent load. | Medium |