Compiling brilliance
Did you know? An LRU cache is a HashMap + a doubly-linked list → O(1) get & put.
Compiling brilliance
Did you know? An LRU cache is a HashMap + a doubly-linked list → O(1) get & put.
Tag
72 articles tagged interview-questions.
How a streaming service prepares video: splitting a master into segments, fanning out parallel transcode jobs across a segment-by-rendition matrix, progressive playability, and serving from the edge.
How a mentorship platform like Preplaced matches people: hard filters that remove the unqualified, a weighted skill-overlap score that ranks the rest, and the search-match-book architecture.
How a creator-session platform works inside: turning availability windows into bookable slots, the interval-overlap test that prevents double-booking, and the hold-pay-confirm flow.
How a crypto exchange tracks money correctly: a double-entry ledger where balanced transactions conserve value, overdrafts are impossible, plus hot/cold wallet custody and the deposit/withdraw flow.
How a secure tunneling service works inside: the reverse tunnel that needs no open firewall port, stream multiplexing many requests over one connection, and subdomain routing at the edge.
How Google Docs lets many people edit one document at once: why naive concurrent edits diverge, how Operational Transformation rewrites operations to converge, and the central-server OT architecture.
How an email service works inside: accept-fast ingestion, the shared message store plus per-user mailbox index, conversation threading by reply headers with union-find, and per-user search.
How a voice assistant works inside: the wake-word-to-speech pipeline, the NLU layer that resolves an utterance to an intent and slots, the thin-device cloud-brain split, and the skill fan-out.
The two ideas at the core of a game engine: a fixed-timestep loop that makes simulation deterministic at any frame rate, and an Entity-Component-System that composes behaviour without inheritance.
Modelling version control in a database the way Git does: content-addressable blobs, trees and commits as a Merkle DAG, structural sharing of unchanged files, and the two-table schema that backs it.
How a serverless platform works inside: the invocation path, cold versus warm starts, the scheduler that reuses execution environments, concurrency-limited autoscaling, and where latency goes.
How a write-optimized NoSQL store works inside: the LSM tree (memtable, write-ahead log, immutable SSTables), the read path with bloom filters, compaction and tombstones, and LSM versus B-tree.
A LinkedIn system design: the connection graph, degrees of separation via BFS, People You May Know ranked by mutual connections, why deep traversal is precomputed, and scaling the graph.
A Tinder system design: mutual-match detection that fires exactly once, the recommendation deck from a geospatial index, the swipe write firehose, privacy of one-sided likes, and scaling.
A Zoom / video-conferencing system design: mesh vs SFU vs MCU topologies, an SFU that uploads once and fans out, simulcast layer selection, signaling vs media, NAT traversal, and scaling rooms.
A file sync system design (Dropbox / Drive): content-addressed chunks with dedup, delta sync that uploads only changed chunks, the metadata-vs-block split, and conflict handling.
An AWS S3 system design: a flat bucket/key namespace, durability via erasure coding across AZs, the metadata index mapping keys to shards, multipart upload, and how object storage scales.
A load balancer system design: balancing algorithms (round-robin, least-connections, consistent hashing), health checks, L4 vs L7, and keeping the balancer itself from being a single point of failure.
A Google Maps system design: modelling roads as a weighted graph, A* routing with an admissible heuristic, precomputation for continent scale, live-traffic edge weights, and map tiles.
A WhatsApp / chat-at-scale system design: persistent connections and a routing registry, store-and-forward for offline users, idempotent ordered delivery, and the delivery-tick receipts.
A real-time collaborative editor design (CodePair / Google Docs-style): a sequence CRDT with fractional positions, converging concurrent edits over WebSockets, presence, and per-room scaling.
A BitTorrent system design: splitting a file into hashed pieces, the peer swarm and tracker, rarest-first piece selection, tit-for-tat incentives, and why P2P scales up as demand grows.
A stock exchange system design (Zerodha): a limit order book with price-time priority, the matching algorithm, an in-memory engine kept durable by a journal, and correctness over availability.
An Amazon system design on the always-available shopping cart: AP over CP, a Dynamo-style replicated key-value store, quorums, consistent hashing, and merging divergent carts.
An Airbnb / OYO system design: geospatial search with geohash prefixes, date-range availability, booking without double-booking, the data model, and scaling location search.
A database deep dive on modelling Google Calendar: storing a recurrence rule instead of infinite instances, expanding on read, cancellations and overrides, timezones/DST, and time-range queries.
A Spotify system design: storing audio as a chunked bitrate ladder in object storage behind a CDN, adaptive bitrate selection from bandwidth and buffer, the metadata model, and play history at scale.
A Stack Overflow system design: full-text search via an inverted index ranked by TF-IDF and votes, a read-heavy cache/CDN path, the Q&A data model, and keeping search in sync with the source of truth.
A live cricket score system design (Cricinfo-style): read fan-out to tens of millions, collapsing a hot key with caching and single-flight, push vs poll delivery, and freshness over consistency.
A database deep dive on modelling Reddit-style threaded comments in SQL: adjacency list vs materialized path vs closure table, fetching a subtree in one query, plus scores and sharding by post.
A newsletter service system design: fan a campaign out to millions of subscribers, the send-log idempotency key that stops double-sends, plus deliverability, retries, and open/click tracking.
An ad click event aggregation system design (HLD): tumbling windows, exactly-once counting by dedup, the Count-Min Sketch for fixed-memory counts, and stream processing with a batch recompute.
A real-time leaderboard system design (HLD): why top-N is easy but a single player's rank is hard, the sorted set and order-statistics that make rank O(log n), time windows, and the hot-key at scale.
A Twitter / X news feed system design (HLD): fan-out on write vs read, the celebrity problem, the push-pull hybrid, and assembling a timeline by merging K sorted streams at scale.
A ride sharing system design (Uber/Ola-style): the geospatial cell index that finds nearby drivers fast, the driver offer as a hold with a TTL, the double-match race, and surviving a hot region.
A movie ticket booking system design (BookMyShow-style): the data model, a seat-hold with a TTL, stopping double-booking with an atomic update, and idempotent payment at scale.
A low-level design walkthrough of a web crawler core: the frontier queue, URL normalization before deduplication, a shared seen-set, per-host politeness, and termination by in-flight count.
A low-level design walkthrough of an online voting system: separating eligibility from the ballot so one vote per voter never links who voted to what, with an append-only, recountable tally.
A low-level design walkthrough of audio fingerprinting like Shazam: reducing a spectrogram to peak landmarks, hashing point pairs, and matching a noisy snippet by voting on a consistent offset.
A low-level design walkthrough of TOTP and Google Authenticator: a shared secret and the clock through HMAC to six digits, with an acceptance window that tolerates skew and blocks replay.
A low-level design walkthrough of a text editor core like Sublime: the gap buffer for fast cursor-local edits, plus undo/redo stacks built from edits that describe their own inverse.
A low-level design walkthrough of a download manager: splitting a file into byte-range segments, downloading them in parallel with retries, and resuming after a crash from an on-disk journal.
A low-level design walkthrough of a bar graph chart library: series data, a linear scale with nice ceilings, and pluggable renderers that draw the same chart in the console and as SVG.
A low-level design walkthrough of a coupon and promo system: eligibility rules as composable data, discounts with caps, the preview-redeem split, and usage limits that survive a rush.
A low-level design walkthrough of the Android unlock pattern: the crossing rule as a lookup table, pattern validation in O(1) per move, and counting all valid patterns with backtracking and symmetry.
A low-level design walkthrough of an online book reader system: a catalog of shared books, per-user sessions, page navigation that clamps at the covers, and the user-book bookmark as the hidden noun.
A low-level design walkthrough of a car rental system: reservations against category capacity instead of specific cars, interval counting on the calendar, pickup-time assignment, and late-fee billing.
A low-level design walkthrough of a thread pool: the bounded work queue, the worker loop that must never die, saturation and rejection, and the graceful shutdown promise — fully tested.
A low-level design walkthrough of a Splitwise expense sharing system: immutable expenses, derived balances, split strategies with the rounding paisa rule, and greedy debt simplification.
A low-level design walkthrough of a call center: rank-based dispatch across respondents, managers and a director, escalation that re-dispatches, queues per rank, and the freed agent who drains them.
A low-level design walkthrough of an elevator system: why first-come-first-served zigzags, the LOOK sweep algorithm, hall calls vs car calls, direction as state — fully implemented and tested.
A low-level design walkthrough of an AWS-style alarm and alert service: threshold rules as data, consecutive-breach debouncing, three honest states, and observers notified on transitions only.
A low-level design walkthrough of an airline booking system: identity inventory where seat 12A is nobody's substitute, the PNR as hidden noun, and seat holds that expire by the lazy clock.
A low-level design walkthrough of a hotel management system: half-open date ranges, the one-line overlap formula, booking a room type while the hotel assigns the room — fully implemented.
A low-level design walkthrough of an inventory management system: on-hand vs reserved vs available, two-phase reservations with commit and release, and the race that double-sells the last unit.
A low-level design walkthrough of a restaurant management system: seating by table fit, order tickets through a kitchen queue, and billing that frees the table — coordinated state machines.
A low-level design walkthrough of an in-memory file system: files and directories behind one Node interface, path resolution as a walk, recursive size via the Composite pattern — fully implemented.
A low-level design walkthrough of a JSON parser: the grammar as a call graph, recursive descent with a position cursor, escape and number handling, and error messages that point.
A low-level design walkthrough of a logging library: ordered levels, a cheap threshold gate, formatters, appenders as a Strategy, and the complete implementation of the log4j shape.
A low-level design walkthrough of an ATM: a state machine that retains cards after three wrong PINs, a bank service interface because the ATM owns no truth, and cash planned before any debit.
A low-level design walkthrough of chess: scoping the unbuildable, one movement rule per piece via the Strategy pattern, a shared path-clear helper for sliding pieces, and the complete implementation.
A low-level design walkthrough of Tetris: why the falling piece never lives on the board, rotation as pure arithmetic, line clears as a filter, and the complete implementation of the classic.
A low-level design walkthrough of a jackpot slot machine: independent reels with injected randomness, the paytable as data instead of if-chains, and a credits ledger that always balances.
A low-level design walkthrough of minesweeper: separating truth from view, the flood fill cascade done with discipline, first-click safety, and the complete implementation of the classic.
A low-level design walkthrough of the 2048 game: the merge-once rule everyone breaks, why all four directions are one mergeLeft function, win and lose detection, and the complete implementation.
A low-level design walkthrough of snake and ladder: why snakes and ladders are one Map, how injecting the die makes the game testable, and the complete implementation with a clean turn loop.
A low-level design walkthrough of a vending machine: coins, inventory, the can't-make-change trap, and when design patterns earn their keep — the honest path from if-checks to the State pattern.
A low-level design walkthrough of tic tac toe (Tic-Tac-Toe): an O(1) win check with counters, a clean state machine, and the complete implementation of the classic warm-up interview question.
How to approach any low-level design interview: turn requirements into classes, methods, and state machines — the parking lot classic, fully built — plus a cheat sheet for picking design patterns.
How to approach any high-level design interview: extract the data model and APIs from plain sentences — nouns, verbs, hidden tables — applied live to a Zomato-style food delivery system design.
A friendly tour of the Stream API and functional programming: lambdas, pipelines, laziness, collectors — then interview questions on frequency counts, grouping, duplicates and second-highest.
A friendly tour of multithreading: threads, race conditions, synchronized, wait/notify — then the classic interview questions, odd-even printing, producer-consumer and deadlocks, solved and explained.