Problems
Callback's own problems and the LeetCode questions companies have been asking, in one place — pick a category, then filter by company, frequency, status, difficulty, topic, and language.
Algorithms & Data Structures · Greedy line packing and fiddly space math — full text justification.
System Design · Token bucket, sliding window, and where the counters live.
System Design · The classic: encoding, storage, and redirects at scale.
System Design · Fan-out on write vs. read, ranking, and the celebrity problem.
Behavioral · The most common behavioral prompt, told in STAR: a disagreement where you changed the outcome, or changed your mind.
Algorithms & Data Structures · Arbitrary-precision rounding — floats need not apply.
Algorithms & Data Structures · Streaming design: recent counts, top-k, and sliding-window bans.
Algorithms & Data Structures · Order and duplicates vanish at every depth — canonicalize.
Assign Pins to Shortest Columns
Algorithms & Data Structures · The masonry-layout greedy: shortest column wins, leftmost on ties.
Collect Pins from Reachable Boards
Algorithms & Data Structures · BFS over the bipartite pin-board graph without building board-to-board edges.
Algorithms & Data Structures · Reassemble lines from arbitrary chunks, reading lazily.
Algorithms & Data Structures · Advance players in O(1), rank them without sorting — a linked list per room.
Algorithms & Data Structures · Meet new group sizes while disrupting as few buckets as possible.
Algorithms & Data Structures · Interval sweep for the free ranges — independent of bucket-space size.
Algorithms & Data Structures · Smallest-free allocation under a capacity that moves at runtime.
Cross-Reference Logs to Flag Spam Numbers
Algorithms & Data Structures · A hash join across two logs — and saying that word out loud.
Sparse Matrix Storage, Addition, and Multiplication
Algorithms & Data Structures · Storage proportional to nonzeros — and the cancellation trap.
Select the Nearest Eligible Elevator
Algorithms & Data Structures · A requirements-gathering problem wearing a simulation costume.
Decide Target via Subsequence Plus/Multiply Expression
Algorithms & Data Structures · Expression search with precedence — the (total, pending product) trick.
Compute Reachable Cells for a Cleaning Robot
Algorithms & Data Structures · Slide-until-blocked physics: rest positions are the states, not cells.
Maximize Boxes Stored Through One Entrance
Algorithms & Data Structures · Prefix-min ceilings plus an exchange-argument greedy.
Mark and Compact a Heap-Indexed Subtree
Algorithms & Data Structures · Garbage collection in miniature: mark a subtree, compact, remap.
Implement Single-Tab Browser History Navigation
Algorithms & Data Structures · A cursor over one visit stack: truncate forward history, clamp at both ends.
Frontend · List state done right: keys, controlled input, and deletes.
Algorithms & Data Structures · Pack named ID ranges, then resize with all-or-nothing shifts.
Algorithms & Data Structures · Net the balances, then match debtors to creditors greedily.
Algorithms & Data Structures · Use every ticket once: Hierholzer's walk, smallest destination first.
Algorithms & Data Structures · Two sorted indexes and a binary search you write by hand.
Algorithms & Data Structures · BFS over routes, not stops — clear each stop as you expand it.
Algorithms & Data Structures · Two out-edges per index: a graph search with a visited array.
Restaurant Seating: Free Intervals
Algorithms & Data Structures · A +ppl/−ppl sweep; occupancy is constant between events.
Count Pins on a Two-Column Screen
Algorithms & Data Structures · Only n scroll offsets matter — slide the window to a pin's top.
Count Subarrays with Score Below K
Algorithms & Data Structures · Positives make sum × length monotone — a two-pointer window.
Count Objects in a Pixel Grid via an API
Algorithms & Data Structures · Flood fill through an opaque API — isSameObject is the catch.
Algorithms & Data Structures · Open roads cost 0, closed cost 1 — textbook 0-1 BFS.
Algorithms & Data Structures · A min-heap of (free time, agent) — tuple order breaks the ties.
Algorithms & Data Structures · lower_bound on the prefix itself, then one startswith check.
Stateful Search Autocomplete Session
Algorithms & Data Structures · A typing session over search counts: top three by frequency, then alphabetically.
Algorithms & Data Structures · Parse (count, digit) pairs backward — adjacent runs must differ.
System Design · Recsys serving, not a social timeline — retrieval funnels, session state, four nines.
System Design · Fan-out, viral-pin aggregation under skew, and deciding not to send.
System Design · Tries with precomputed top-k, prefix sharding, and freshness by atomic swap.
Design an Ads Event Reporting System
System Design · Streaming for dashboards, batch for billing truth — and hot keys from viral ads.
Design a Merchant Catalog Update Pipeline
System Design · Idempotent bulk ingestion with per-item ordering, fairness, and safe deletions.
Design Image Upload and Serving for Pins
System Design · Presigned uploads, content-addressed variants, and a CDN that caches forever.
Design the Pins and Boards Data Model
System Design · Sharding a relational model: object tables, mapping tables, no cross-shard joins.
System Design · Embeddings, sharded ANN retrieval, and fresh pins searchable in seconds.
System Design · Metadata plane vs data plane, chunk replication, and the atomic-commit moment.
Algorithms & Data Structures · Sort both teams, pair i-th against i-th, and try both orders.
Algorithms & Data Structures · The largest nearest-sensor gap — sort one side, binary search from the other.
Algorithms & Data Structures · Interval greedy: extend coverage with the farthest-reaching clip that still connects.
Shortest Path Around Obstacles
Algorithms & Data Structures · Unit steps on a grid: BFS, and the first arrival is the answer.
Algorithms & Data Structures · Union-Find: an edge whose endpoints already share a root closes a cycle.
Algorithms & Data Structures · Unbounded knapsack in disguise — say that out loud, then roll a 1-D table.
Algorithms & Data Structures · Tokenize into groups of choices, then fold a cartesian product across them.
Algorithms & Data Structures · An undo log per open transaction: rollback replays it, commit hands it to the parent.
Algorithms & Data Structures · Two-pointer scans with no library calls — the point is proving you can.
Algorithms & Data Structures · Injected transport, upserts keyed by id, a dirty set — a small class with senior signals.
StoreData with Change Listeners
Frontend · A Backbone.Model-style store: two Maps, one event-key normalizer, listeners that can't break each other.
Frontend · A one-way state machine, a handler queue, and every callback in a microtask.
Debounce with Cancel and Flush
Frontend · A trailing-edge debounce whose wrapper can also drop the pending call or run it now.
Frontend · Declarative rule factories and one message per field — the first failing rule's.
Algorithms & Data Structures · A tree of nodes keyed by path segment — the OOD-style prompt where the implementation is the test.
Algorithms & Data Structures · Simulate one unit at a time — left, then right, else stay — and land only on strictly lower ground.
Frontend · A tab UI packaged as an initializer — two independent instances from one function.
Frontend · Real radio inputs behind the stars: the form submits itself, the keyboard works, N instances are N names.
Frontend · Fisher–Yates, a splice, and fresh nodes per deal — the reveal animation comes free.
Typeahead with Keyboard Navigation
Frontend · Debounce the query, abort the stale request, cache by query, wrap the arrow keys, wire the combobox.
Carousel with a Per-Slide Countdown
Frontend · One interval per slide, one batched update per advance — and the double-advance trap.
Frontend · Immutable board updates, gravity in dropPiece, and a win check that only looks through the last move.
Algorithms & Data Structures · The two-pointer warm-up: one pointer at each end.
Algorithms & Data Structures · Cycle detection dressed up as a scheduling question.
Algorithms & Data Structures · Greedy word wrap inside ASCII borders — never split a word, never start a line with punctuation.
Algorithms & Data Structures · Split first, decode second — the ordering that makes the encoded-ampersand case work.
Algorithms & Data Structures · Case-insensitive, longest match wins, original text preserved — a trie walk from every offset.
Algorithms & Data Structures · Pluggable backoff, a retryable filter, hooks, and an abort signal around one loop.
Algorithms & Data Structures · Consume the oldest stock first and say which lots an order drew from — an implementation prompt with tie-break rules.
Frontend · Two arrays and one Set of checked ids — get a working version fast, then polish.
Algorithms & Data Structures · Parse, validate, count — and pick the right denominator for the failure rate.
Memory-Bounded Ranked Ballot Counter
Algorithms & Data Structures · Millions of ballots, Borda scoring, and memory that stays O(candidates) — the constraint is the question.
Algorithms & Data Structures · Bucket sort when the multiset fits, a size-N heap when it's a stream — say both.
Algorithms & Data Structures · "Bidirectional and transitive" means connected components — union-find, keyed by the smallest word.
Algorithms & Data Structures · Flood fill from every unvisited land cell — and know when DFS, BFS or union-find fits.
Algorithms & Data Structures · Three linear phases instead of a re-sort: before, overlapping, after.
Algorithms & Data Structures · Separate chaining with a resize at a load-factor threshold — fixed buckets aren't enough.
Algorithms & Data Structures · A heap cannot update a key — push the new entry and discard stale ones at pop time.
Algorithms & Data Structures · One DFS from the base unit multiplies factors down the tree, modulo a prime.
Nth Node at Level L in a 0/1 Tree
Algorithms & Data Structures · Never build the tree — halve recursively, or read the answer off the parity of popcount(n − 1).
Algorithms & Data Structures · A queue of admitted timestamps per key: evict what aged out, admit while under the limit.
Algorithms & Data Structures · Flatten behind hasNext/next with O(depth) memory — and survive [[], [[]], [[], [3]]].
Algorithms & Data Structures · One pass and O(k) memory: item i replaces a random slot with probability k/(i+1).
Algorithms & Data Structures · Two heaps — a max-heap for the lower half, a min-heap for the upper — rebalanced on every add.
Algorithms & Data Structures · Three guarded divisions — and 0 wherever a denominator is 0.
Algorithms & Data Structures · Map, combine, partition, sort, reduce — the three parts a groupby does not have are the whole grade.
Algorithms & Data Structures · Half-open intervals per room, only neighbours can clash — and check-then-book must be one atomic step.
Algorithms & Data Structures · Idempotent writes, a separate read model, and an audit log — all three in one small service.
Algorithms & Data Structures · One pass with a stack of signed terms; the trap is integer division truncating toward zero.
Algorithms & Data Structures · Build in-order and pull values off a forward-only iterator — no middle-finding, no array copy.
Algorithms & Data Structures · Build the trie first and say why: it prunes the DFS the moment a prefix does not exist.
Algorithms & Data Structures · A group dies exactly when it has no adjacent empty point — flood fill each neighbouring enemy group.
Move 200 TB of Media to GPU Training Hosts
System Design · Do the bandwidth arithmetic out loud, land in object storage, and never let the GPUs read small files.
Design an ML Evaluation Platform
System Design · Versioned benchmarks, cached (model, item) runs, and confidence intervals — presented as a spoken walkthrough.
Algorithms & Data Structures · TCP is a byte stream: buffer across calls, frame by length prefix, and tell a clean EOF from a truncated message.
Implement a Robust REST Create Method
Algorithms & Data Structures · Authenticate, validate, sanitise — then make POST safe to retry with an Idempotency-Key scoped to the caller.
Design Cloud Photo Storage and Multi-Device Sync
System Design · Bytes go straight to object storage; a per-library change feed with sync tokens is the actual product.
Design a Centralized Logging System
System Design · Agents, a durable buffer, tiered storage — and deciding how much to index before the bill decides for you.
Design Cross-Device Wallpaper Synchronization
System Design · A client-side design: apply locally at once, converge eventually, and never let sync touch the main thread.
Design the APIs for an Election Voting System
System Design · One final ballot per voter, results sealed until close — contracts, the one-transaction rule, and a recount path.
Design an Accurate Ad Click Aggregator
System Design · Dedup by impression, event-time windows with watermarks, idempotent sinks — and a batch recount that owns the truth.
System Design · Content-addressed blocks, a per-namespace journal, and conflicted copies instead of silent loss.
Design Disk-Based Inventory Serving
System Design · No SSD, little RAM: count seeks, make writes sequential, and keep the hot counters — not the metadata — in memory.
Scale Digit-Square Convergence Requests
System Design · One pass plus a 1,621-entry table makes compute free — so the design is about avoiding the network, not caching.
Design a Video Sharing Platform
System Design · A transcoding pipeline feeding a CDN: egress is the bill, so codec, ladder and cache strategy are the design.
Design a Marketplace Catalog System
System Design · Category-driven attribute schemas, products versus offers, and a search index that is always rebuildable from the source of truth.
Design and Scale a Yelp-like Reviews Platform
System Design · Geo plus text search over a read-heavy model, with review writes fanned out through queues to aggregates and the index.
Design a Smartwatch Sensor Subsystem
System Design · Heart rate on a moving wrist inside a milliwatt budget: sensor choice, a sensor hub, motion-artifact rejection, and proof it works on everyone.
Migrate a Monolithic Wallet to Microservices
System Design · Strangle the monolith in phases, keep money movement inside one ledger's transaction, and use sagas only around the outside world.
Algorithms & Data Structures · Sort, then sweep — the pattern behind a dozen calendar problems.
Algorithms & Data Structures · Hash map plus doubly linked list, all operations O(1).
Algorithms & Data Structures · One pass, three sets — and derive the box index out loud instead of asserting it.
Algorithms & Data Structures · Two-colour with BFS from every unvisited node; an odd cycle is the only way to fail.
Algorithms & Data Structures · A 26-count key instead of sorting each word — the only decision in the problem.
Algorithms & Data Structures · BFS, not DFS — shortest path — then mention bidirectional BFS, which roughly square-roots the frontier.
Implement Array.prototype.flat
Frontend · Depth, holes and Infinity — without recursion, so 100,000 levels can't overflow the stack.
Frontend · Pre-size the output so holes stay holes, and forward thisArg.
Frontend · Take functions, not promises — then never call the next task until the previous one settles.
Frontend · A sliding window of N workers: results in input order, nothing new after a failure.
Frontend · A promise that settles after a second, rejecting with an Error — then consumed with await and try/catch.
Frontend · Explain the prototype chain, then rebuild a class ... extends pair from constructor functions, without the new Parent() trap.
Frontend · Cycles, shared references, Date, RegExp, Map, Set, prototypes and symbol keys: everything spread and JSON get wrong.
Frontend · A closure over a Map keyed on every argument — and has, not truthiness, so 0 and undefined still hit.
Frontend · Read a nested value by path, and return the fallback only when it is missing, never when it is merely falsy.
Frontend · Step by size and slice — after clamping the size, because 0 loops forever.
Frontend · The dotted path to every primitive in a nested object or array — even when the input has cycles.
Algorithms & Data Structures · The first character whose second occurrence comes earliest — one pass with a set, emoji included.
Unique Values Across Two Arrays I
Algorithms & Data Structures · Every value once, in first-seen order — a Set keeps insertion order.
Algorithms & Data Structures · Prefix products left to right, suffix products right to left — no division, so zeros need no special case.
Algorithms & Data Structures · PUT, GET and a COUNT of everything under a domain: match on the label boundary, then make COUNT fast with a trie.
Algorithms & Data Structures · A second stack holds the minimum at each depth, so getMin is just its top.
Parse an Integer Without parseInt
Algorithms & Data Structures · Sign, then digits through a lookup table, accumulating n * 10 + d — and NaN for anything else.
Frontend · Turn { id, name, parentId } rows into a tree in one pass, then render every level as tabs under its parent.
Frontend · Pack cards of different heights into tight columns with CSS alone, then explain what CSS-only masonry cannot do.
Frontend · A promise around a <link>, memoized by href, that forgets failures so a retry can work.
Multi-Step Form With a Shared Store
Frontend · Three steps, one reducer: data survives Back, each step validates before Next, and submitting locks the form.
Star Rating With Half Stars, at Scale
Frontend · Click to fill, half stars from the click position, a thousand stars, and updates that touch only what changed.
Tic-Tac-Toe: N by N, M in a Row
Frontend · A board of any size, a win check that looks only through the last move, and a status line for turn, winner or draw.
Frontend · Six one-digit fields that feel like one: advance on entry, Backspace back, paste the whole code, lock while verifying.
Image Carousel With One Image Element
Frontend · Previous, next and page buttons that wrap around, any aspect ratio fitted to a fixed frame, and a single <img>.
Predict the Output: Promise and Timer Order
Frontend · A promise resolved inside a timer, two more timers, and a microtask: the event loop decides the order.
Predict the State: A Redux Reducer
Frontend · Trace three dispatches through a reducer by hand — and read the case labels character by character.
Frontend · A function plus the bindings of the scope it was created in — bindings, not snapshots.
Frontend · Capture down, target, bubble up — and why delegation depends on it.
Frontend · Browsers block cross-origin reads unless the server opts in — it protects users, not servers.
Design an Autocomplete Component (Front End)
System Design · A reusable typeahead: the component API, a data layer that debounces, cancels and caches, and the combobox pattern done properly.
Design a Music Streaming Web App (Front End)
System Design · A player that keeps playing across navigation, a queue model, streaming and preloading audio, and state shared across tabs and devices.
Design a Photo Sharing App (Front End)
System Design · An infinite feed of images without layout shift, optimistic likes, and an upload flow that resizes, strips location and survives a bad connection.
Algorithms & Data Structures · Split the nonzero balances into as many zero-sum groups as possible.
Algorithms & Data Structures · Rebuild the itinerary with Hierholzer's walk, then look for a repeat.
Algorithms & Data Structures · BFS from the start: the layer where the last index appears is the answer.
Algorithms & Data Structures · The count served by time T is monotone — binary search T.
Algorithms & Data Structures · Matches are contiguous: lower_bound the prefix, then the prefix bumped by one.
Algorithms & Data Structures · The reverse parse, memoized on (index, previous digit) — count, don't build.
Algorithms & Data Structures · Split, round each value with string arithmetic, join — floats need not apply.
Algorithms & Data Structures · Reassemble the lines, net the balances, then search for the fewest transfers.
Algorithms & Data Structures · Only faced pairs matter: greedily match the smaller team into the larger.
Algorithms & Data Structures · The greedy match, written into two rows with empty slots.
Fewest Towers to Cover Every Crossing
Algorithms & Data Structures · Greedy: place each tower as far right as the leftmost uncovered crossing allows.
Algorithms & Data Structures · One formula for every dimension: the square root of the summed squared differences.
Shortest Path on a Huge Map with A*
Algorithms & Data Structures · BFS's answer, found by expanding cells in order of cost-so-far plus an admissible estimate.
Shortest Path with Terrain Costs
Algorithms & Data Structures · Unequal step costs turn BFS's queue into Dijkstra's priority queue.
Algorithms & Data Structures · A three-line grammar turns nested braces into a tiny recursive-descent parser.
Algorithms & Data Structures · Find the end of each run (or each number), emit, jump.
Algorithms & Data Structures · A read pointer and a write pointer over the same array — write never passes read.
Algorithms & Data Structures · The farthest-reach greedy again, remembering which clip won each round.
Algorithms & Data Structures · Sweep sorted clips tracking the farthest end; a start past it opens a gap.
Algorithms & Data Structures · Start at n components; every successful union merges two into one.
Algorithms & Data Structures · Kahn's algorithm: peel sensors with no pending inputs; leftovers mean a cycle.
Algorithms & Data Structures · The rod-cutting table again, charging for every cut and seeding the whole-rod sale.
Algorithms & Data Structures · Add a piece-count dimension: dp[k][L] builds on dp[k − 1][L − p].
Algorithms & Data Structures · Buckets plus underflow and overflow: O(1) adds, any quantile, error within half a bucket.
Algorithms & Data Structures · Sort by (entity, time), then extend or open one session per entity in a single sweep.
Algorithms & Data Structures · Convert through the base unit — and divide with a modular inverse, since you can't divide mod p.
Algorithms & Data Structures · Store (tokens, last seen) per key and refill lazily on each call — O(1) per key.
Algorithms & Data Structures · Chain iterables behind hasNext/next with a lookahead that skips the empty ones.
Weighted Sampling Without Replacement
Algorithms & Data Structures · A-Res: key each item by random()^(1/weight) and keep the k largest keys.
Stratified Sampling with Largest-Remainder Allocation
Algorithms & Data Structures · Floor each proportional share, give leftovers to the largest remainders, sample within each stratum.
Algorithms & Data Structures · Discount each graded relevance by log2(position + 2), then divide by the ideal ordering's DCG.
Algorithms & Data Structures · Observed agreement corrected for the agreement two annotators would reach by chance.
Algorithms & Data Structures · 1 − C(n − c, k) / C(n, k), computed as a running product so nothing overflows.
Algorithms & Data Structures · Buffer bytes across recv calls, split on newlines, and decode only whole lines.
Frontend · Group items by key into a null-prototype object — because {} already has "constructor".
Algorithms & Data Structures · Where the earliest second occurrence sits — the same set scan, returning an index.
Unique Values Across Two Arrays II
Algorithms & Data Structures · Count every value across both arrays in a Map, then keep the ones counted exactly once.
Unique Values Across Two Arrays III
Algorithms & Data Structures · Objects compare by reference, so deduplicate on a property — the first object with each key wins.
Algorithms & Data Structures · Binary long multiplication: add the doubled multiple for every set bit — and double with +=, not a 32-bit shift.
Implement Array.prototype.filter
Frontend · Skip holes, forward thisArg, and keep the elements whose callback is truthy.
Implement Array.prototype.reduce
Frontend · A missing initial value versus an undefined one — and the TypeError when there's nothing to reduce.
Implement Array.prototype.concat
Frontend · Spread arrays and isConcatSpreadable objects one level, keep holes, append everything else.
Drive a Generator Like async/await
Frontend · Resume the generator with each resolved value, and throw each rejection back in at the yield.
Frontend · Start every call at once and let Promise.all keep the input order.
Frontend · Store results by index, count down, resolve an empty input at once, reject on the first failure.
Frontend · Race the promise against a timer — and clear the timer when the promise wins.
Frontend · Collect arguments until fn.length have arrived — with a fresh array per call so partials stay independent.
Frontend · A called flag, not a check on the result — and the first call's this and arguments.
Algorithms & Data Structures · Each position multiplies its two successors, wrapping around the end with modular indices.
Count Each Character in First-Seen Order
Algorithms & Data Structures · One counting pass into a Map, emitted in insertion order: AAABBAA becomes 5A2B.
Algorithms & Data Structures · A base case at n <= 0 and one recursive call — then say where the call stack runs out.
Algorithms & Data Structures · Binary-search the root in [0, max(1, x)] for a fixed number of rounds — an epsilon loop never ends for large x.
Algorithms & Data Structures · An infinite generator over two BigInts — ordinary numbers lose precision past the 78th term.
A Tooltip Library From data Attributes
Frontend · One tooltip node, delegated listeners, keyboard focus and Escape — in plain DOM, not a component.
Predict the Output: What a Spread Copies
Frontend · { ...first } copies the top level only — a nested object stays shared.
Predict the Output: `this` in an Arrow Method
Frontend · An arrow function takes this from where it is defined — and an object literal is not a scope.
Predict the Output: The Temporal Dead Zone
Frontend · A block-scoped const shadows the outer one from the top of its block — before its line runs.
Predict the Output: A then and finally Chain
Frontend · A promise settles once, finally passes values through, and a rejection handler can recover.
Predict the Output: var Hoisting With Shadowing
Frontend · A var inside the function is hoisted and initialized to undefined, shadowing the outer one.
Predict the Result: Type Coercion
Frontend · What adding "0" to a number does, and a table of +, == and comparison gotchas.
Predict the Output: async/await and the Microtask Queue
Frontend · An async function runs synchronously up to its first await; the rest is a microtask.
Predict the Output: var and let in a Loop With Timers
Frontend · var gives the loop one shared binding; let gives each iteration its own.
Predict the Output: Nested Context Providers
Frontend · Default value, nearest provider, and why memo doesn't stop a context update.
Which Effect Fetches Data Once on Mount?
Frontend · No dependency array loops, an async effect returns a promise, and a fetch in the render body runs every render.
Which Statement About React Context Is Correct?
Frontend · Context in React 16.3 and later: how it's created and who can read it.
What Are the States of a Promise?
Frontend · Pending, then fulfilled or rejected — settled is final, and handlers always run later.
What Were the Best Improvements in ES6?
Frontend · Pick two features and say which bug each one removed.
Frontend · "Is a" ties the child to the parent; "has a" combines small parts.
Frontend · The byte order of multi-byte values — and where JavaScript makes you care.
What Do Object-Oriented Languages Share?
Frontend · Encapsulation, inheritance and polymorphism — and how JavaScript gets inheritance.
Cookies, localStorage or sessionStorage?
Frontend · Size, lifetime and who can read it — HttpOnly cookies survive XSS.
Frontend · HTTPS, CSP, cookie flags and escaping — each named with the attack it stops.
Frontend · fetch resolves on a 500; Axios rejects, parses JSON and intercepts.
Frontend · One round trip and typed data, paid for in caching, query cost and N+1 resolvers.
How Do You Build an npm Package?
Frontend · package.json fields, ESM builds with types, peer dependencies, and a dry-run before publishing.
What Makes a Good Code Review?
Frontend · Correctness first, then readability and tests — small diffs, specific comments.
How Would You Structure a Repo From Scratch?
Frontend · Group by feature, keep tests beside code, and wire checks into CI from the first commit.
Frontend · Name what you test with it — including timers with fake timers.
When Would You Use useMemo or useCallback?
Frontend · They cache a value and a function identity — and only matter when something compares them.
preventDefault or stopPropagation?
Frontend · One cancels the browser's default action; the other stops the event traveling.
Why <!DOCTYPE html>, and What Is Quirks Mode?
Frontend · The doctype selects standards mode; without it, browsers emulate 1990s layout.
Frontend · A GPU texture the compositor can move or fade without layout or paint.
How Do You Make a Page Accessible?
Frontend · Native elements first, then names, keyboard, contrast, motion — and a real example.
How Would You Implement Light and Dark Themes?
Frontend · Custom properties on the root, prefers-color-scheme by default, and no flash of the wrong theme.
How Do You Adjust a Border or a Margin?
Frontend · Content, padding, border, margin — and what border-box changes about width.
How Does the Browser Turn HTML Into Pixels?
Frontend · DOM, CSSOM, render tree, layout, paint, composite — six numbered steps.
Frontend · Which pipeline steps each kind of change re-runs — and how reads force layout.
Frontend · First Contentful Paint and Largest Contentful Paint, with their good thresholds.
How Would You Debug a Blank Page?
Frontend · Console, network, DOM, then bisect the deploys.
How Would You Make a Site Faster?
Frontend · Measure first, then ship less, unblock rendering, cache, and move work.
How Do You Deal With a Slow API?
Frontend · Show a shell at once, cache and parallelize, cancel stale requests — then fix the server.
A Heavy Calculation Freezes the UI
Frontend · Move it to a Web Worker — or chunk it and yield when a worker isn't an option.
Algorithms & Data Structures · Levels from the top down, one character per column — ground, water, or air.
Frontend · Promises can't be cancelled, so cancel the work — and reject once, with an AbortError, only while pending.
Frontend · A leading call, then at most one call per window — with a trailing call that carries the latest arguments.
Algorithms & Data Structures · Each sentence wraps at its own width; one box pads every line to the widest.
Algorithms & Data Structures · A rank histogram and two booleans name every category — the ace is the only edge case.
Nearest Bathroom for Every Desk
Algorithms & Data Structures · Seed the queue with every bathroom and expand once — one BFS for the whole floor, not one per desk.
Algorithms & Data Structures · One pass and two remembered indexes — the last person and the last cake seen.
Algorithms & Data Structures · Nearest-cake greedy is wrong; with both lists sorted, an optimal matching never crosses, so a 2-D DP finds it.
Algorithms & Data Structures · Courses run in waves, and a wave takes as long as its slowest course.
Tree Height After Deletions II
Algorithms & Data Structures · Delete exactly the non-root nodes whose own subtree is k or more deep — one post-order pass, no DP.
Algorithms & Data Structures · Topological order with a 26-bit mask per node: inherited = AND of the parents, final = (inherited OR allow) AND NOT disallow.
Algorithms & Data Structures · BFS over an implicit graph, fetching each page exactly once.
Algorithms & Data Structures · Store one predecessor per page, not a path per queue entry, and walk it back from the target.
Algorithms & Data Structures · A BFS that keeps going after the target is gone — and the thread-safety story that comes with it.
Dropped Requests Under Two Rules
Algorithms & Data Structures · One queue of accepted timestamps per rule; dropped requests never enter either.
Algorithms & Data Structures · Per-client (tokens, last seen), a tier config read on every call, and an explicit fallback for clients with no valid tier.
Algorithms & Data Structures · Timestamps arrive in order, so each type's list is already sorted and a count is two binary searches.
Algorithms & Data Structures · One register, a dictionary of recorded bodies, and a mode flag that says whether a line runs or is being stored.
Algorithms & Data Structures · A heap of entries with lazy deletion: a task added twice has two entries, and the stale one is skipped on the way out.
Key-Value Store With Prefix Scan
Algorithms & Data Structures · A hash map for the point operations and a sorted key list for the scan — agree the smallest version, then extend.
Algorithms & Data Structures · Two pointers per run: find where the run ends, reverse it in place, carry on from there.
Algorithms & Data Structures · Turn each match into a clipped line range, merge ranges that touch, and print a separator between the groups left.
Algorithms & Data Structures · Recursive descent with one cursor: a value function that dispatches on the next character, and a parser per kind.
Document Store With Boolean Queries
Algorithms & Data Structures · An inverted index plus a tiny expression parser whose values are sets of document ids.
Does This Connect Four Move Win?
Algorithms & Data Structures · Only the four lines through the last move can have changed, so count outward in each direction from it.
Algorithms & Data Structures · Count the pieces, then check who has a line: X leads by one if X won, counts are equal if O won, and both cannot win.
Top K Search Terms, One Vote per User
Algorithms & Data Structures · Dedupe (user, term) pairs before counting, then sort by count with the term as the tie-break.
Top K Selling Books After Each Sale
Algorithms & Data Structures · Totals in a map; the top K is recomputed from the map on each update, or kept in a bounded structure when K is small and the catalogue huge.
Algorithms & Data Structures · Dutch national flag with three pointers, using only getColor and swap — one pass, no counting.
Algorithms & Data Structures · A course may start once any one prerequisite is done: swap the max for a min and relax in topological order.
Algorithms & Data Structures · A deleted node hands its children to its nearest surviving ancestor, so it simply adds no level.
Most Credits With at Most K Classes
Algorithms & Data Structures · Weighted interval scheduling with a count budget: sort by end, binary-search the compatible predecessor, add a dimension for the cap.
Algorithms & Data Structures · Meeting rooms with stations: a bus is reusable only where it arrived, so keep the idle buses per station.
Filter With a Dynamic Blacklist
Algorithms & Data Structures · Emitted items are final; held items wait in publish order and are re-checked whenever a word is unblocked.
Is the Graph Three-Colourable?
Algorithms & Data Structures · Backtracking over the vertices: try each colour not used by a coloured neighbour, undo on failure.
Fewest Coins When Change Is Given
Algorithms & Data Structures · Overpaying can save coins: minimise coins handed over plus coins handed back, over every payment up to one large coin above the price.
Design a Distributed Job Scheduler
System Design · A job store as the source of truth, dispatchers that claim due runs with a unique key, leased workers, and a reaper — then the policies a template answer forgets.
Design a Distributed Key-Value Store
System Design · Non-functional requirements first, then one real decision per layer — and the large-value variant, where the lock must never cover the disk write.
System Design · A durable source of truth for grants, a cache of compiled decisions on the caller's hot path, and a closed fail mode.
System Design · Start from a Queue class, then make every step survive a client, server or network failure in the middle of it.
Design a Control Plane for Cloud Clusters
System Design · Desired state in a consistent store, controllers that reconcile, heartbeating agents, and a failure detector that fences before it replaces.
System Design · Append-only events partitioned by account then time, a hot store for recent queries, object storage for retention, and tamper evidence per account.
Design a Pipeline From Bug Tickets to Generated Pull Requests
System Design · A ticket becomes a row with a state machine, a queue feeds long-running workers, and every step is idempotent because the AI step will be retried.
Design an RPC Layer Over Hand-Written REST Calls
System Design · An interface definition that generates stubs and skeletons, with marshalling, discovery, deadlines, idempotent retries and versioning handled once.
Design a Logging Library for Web and Mobile Clients
System Design · A non-blocking log() into a bounded buffer, flushed by size or time, persisted offline, with a stated policy for what to drop under pressure.
Design a Client for an Unreliable Token Service
System Design · Cache tokens with expiry, refresh ahead of time with jitter, single-flight the refresh, and decide between a slightly stale token and a failed request.
Design a Global Multi-Tenant Quota System
System Design · One usage record per tenant across every service, reserve-then-commit, idempotent usage events, and a chosen point between strict consistency and latency.
Design a Distributed Metrics System
System Design · Agents batch to an ingest tier, a time-series store partitioned by metric and time, downsampling for age — and a hard line on cardinality.
System Design · A frontier of URLs partitioned by host, fetchers that respect per-host limits, dedup by URL and by content, and failure handling that never stalls the crawl.
Count the Nodes in a Tree of Servers
System Design · A request fans down the tree and counts fan back up; messages can be lost or duplicated, so every message carries an id and every handler is idempotent.
The Project You Are Most Proud Of
Behavioral · Your flagship story: the goal, your role, the hardest technical problem, and a measurable result.
Your Most Complex Back-End Work
Behavioral · The same flagship project, told through its hardest design decision.
Your Hardest Situation at Work
Behavioral · A deadline or an incident where you had to cut scope and manage risk.
Behavioral · Declining or reshaping a request, with the reasoning and the result.
Delivering Under a Tight Deadline
Behavioral · What you did when the time was not enough: sequencing, trade-offs, communication.
One Piece of Advice for Your Team
Behavioral · A specific process or technical improvement, its impact, and how you would measure it.
Why Are You Leaving, and Why Snowflake?
Behavioral · Growth you want next, tied to something concrete about the work here.
Behavioral · Named tools, the tasks you use them for, a rough share of your coding, and how you verify the output.
SQL & Data · Writers create new versions instead of overwriting, so readers see a consistent snapshot without blocking writers.
SQL & Data · LSM buffers writes in memory and merges sorted files later; a B-tree updates in place for steadier reads.
SQL & Data · Rows suit point lookups and transactions; columns suit scans and aggregates and compress far better.
SQL & Data · Operators process batches of column values instead of one row at a time, cutting interpretation overhead and using CPU caches well.
SQL & Data · Record the change durably before applying it, so a crash can be replayed.
SQL & Data · Read committed, repeatable read, snapshot, serializable — know which anomaly each permits.
SQL & Data · Database storage, independent compute warehouses, and a cloud services layer — a hybrid of shared-disk and shared-nothing.
SQL & Data · Immutable 50–500 MB columnar chunks created automatically, with per-column metadata that lets queries skip them.
System Design · Prepare on all participants, then commit; it blocks if the coordinator dies after prepare.
System Design · A leader replicates a log to a majority before committing; a new leader is elected by majority vote.
Document Coverage: The Shortest Window
Algorithms & Data Structures · Minimum window over tokens: expand until every term is covered, shrink while it stays covered, keep the shortest.
Pick the Query Type That Maximises Revenue
Algorithms & Data Structures · Committing to one type, you run it floor(k / duration) times; score every type and keep the best, earliest on ties.
Reach a Target With +2, Double and Halve
Algorithms & Data Structures · Any sequence counts, so think constructively: +2 keeps parity, doubling then +2s then halving shifts it, and halving is how you get smaller.
Drop and Remove Runs in a Grid
Algorithms & Data Structures · Mark every horizontal and vertical run of three or more, clear them all at once, let columns fall, and repeat until nothing is marked.
Algorithms & Data Structures · Kahn's queue over course objects; a failed attempt goes to the back of the queue and its dependants stay locked until it passes.
Algorithms & Data Structures · A failure is explained if something it depends on, transitively, failed first; the unexplained failures are the root causes.
Algorithms & Data Structures · A recursive-descent parser: a command's operand is either an integer or a parenthesised sub-program evaluated from zero.
Count the Nodes of a Tree by Messages
Algorithms & Data Structures · A node asks every neighbour except the one that asked it, sums the replies plus one, and remembers answers so duplicates are harmless.
Algorithms & Data Structures · Pre-order with explicit end-of-word marks and parentheses around children; parsing it back is a recursive descent.
Pre-Order Traversal Skipping Marked Nodes
Algorithms & Data Structures · A pre-order walk with a stack; a marked node is dropped before its children are pushed, so its whole subtree disappears.
Delete a Node From a Forest Stored as a Parent Array
Algorithms & Data Structures · Children of the deleted node are re-parented to its parent; a deleted root's children become roots.
Rewrite Two Complete Trees With Subtree Sums
Algorithms & Data Structures · In array form the children of i are 2i + 1 and 2i + 2, so merge by index and accumulate sums from the last index down.
Design an Interactive SQL Notebook or Query Execution Service
System Design · A query is a record with a state machine: submit returns an id at once, workers stream results to storage, and clients fetch by id, never by connection.
Design a Multi-Tenant Interactive Analytics Platform
System Design · Immutable columnar files in object storage, a transactional metadata service that commits snapshots, and stateless compute that scales per tenant.
Design a Metadata Catalog and Schema Registry
System Design · Versioned entities in a consistent store partitioned by tenant, a per-tenant change log that caches subscribe to, and soft deletes for undrop.
Design a Cache for a DAG of Materialized Views
System Design · Key every entry by the view, its definition hash and the snapshot versions of all its inputs, so a changed input is a new key and nothing needs explicit invalidation.
Design a Multi-Core Service Startup Scheduler
System Design · Kahn's algorithm with a ready queue and M running slots, where a service unblocks its dependants only after its health check passes and the longest remaining chain goes first.
Design a Multi-Region API Whose Clients Need Tokens From a Flaky Third Party
System Design · Cache what the provider would tell you — signing keys, introspection results, permissions — so a provider outage degrades the API instead of taking it down.
SQL & Data · A window frame of six preceding rows is right only when every day has a row; fill the calendar first.
Extract Fields From a JSON Column
SQL & Data · Path into the document for scalars, cast them explicitly, and flatten arrays into rows before aggregating.
Frontend · Columns of cards with immutable moves: one pure moveCard function serves the buttons and the drag-and-drop alike.
Frontend · State in one object, a pure toggle that flips a cell and its neighbours, one delegated click listener, and a render from state.
Algorithms & Data Structures · A queue with an index pointer, a visited set marked on enqueue, neighbours in the order given.
Algorithms & Data Structures · Split in half, sort each half, merge with two indices — stable, O(n log n), and the merge is the whole interview.
Algorithms & Data Structures · A priority queue of tentative distances; a node's distance is final the first time it is popped.
Frontend · A map from event name to listener list; copy the list before emitting so listeners can unsubscribe mid-emit.
Frontend · Primitives by value (NaN equals NaN), arrays by length and elements, plain objects by key set and values, recursively.
Frontend · A recursive serializer with the real rules: undefined vanishes from objects but becomes null in arrays, and strings need escaping.
Frontend · Two stacks: a new value pushes the old one onto undo and clears redo; undo and redo move values between them.
Frontend · Derive the 64 squares in render — no board in state — then add selection and a move with one piece of state.
Frontend · Keyboard movement with walls and edges, then a breadth-first path to the nearest candy walked one cell at a time.
Frontend · Remember the order cells were lit; when all are lit, a self-re-arming timeout switches them off in reverse.
Frontend · A shuffled deck, at most two face-up ids, a set of matched faces, and one effect that resolves each pair.
Frontend · Two intervals owned by one effect keyed on the running flag, and a round that ends when the clock hits zero.
Frontend · Two corners in state and a derived rectangle; pointer events on cells plus one document listener for the release.
Frontend · A flat array of 225 colours, a palette, draw and erase modes, and a stroke that paints while the pointer is held.
Frontend · Store only the leaves; every parent's checked and indeterminate state is derived from the leaves beneath it.
Frontend · Three pieces of state — page, page size, sort — and rows derived from them in render.
Frontend · A recursive component over nested data, with a set of expanded ids as the only state.
Frontend · A state copy of the value and one effect whose cleanup cancels the pending update on every change.
Asked on LeetCode
3,115 questions · all time
- LRU CachemediumHash TableLinked ListDesignDoubly-Linked List47 companies
- Merge IntervalsmediumArraySortingQuicksort45 companies
- Number of IslandsmediumArrayDepth-First SearchBreadth-First SearchUnion-Find+136 companies
- Two SumeasyArrayHash Table30 companies
- Merge k Sorted ListshardLinked ListDivide and ConquerHeap (Priority Queue)Merge Sort+129 companies
- Trapping Rain WaterhardArrayTwo PointersDynamic ProgrammingStack+128 companies
- Valid ParentheseseasyStringStackBracket Sequences28 companies
- Group AnagramsmediumArrayHash TableStringSorting27 companies
- Text JustificationhardArrayStringSimulation26 companies
- Longest Substring Without Repeating CharactersmediumHash TableStringSliding Window26 companies
- Find Median from Data StreamhardTwo PointersDesignSortingHeap (Priority Queue)+125 companies
- Time Based Key-Value StoremediumHash TableStringBinary SearchDesign25 companies
- Top K Frequent ElementsmediumArrayHash TableDivide and ConquerSorting+425 companies
- Rotting OrangesmediumArrayBreadth-First SearchMatrix25 companies
- Best Time to Buy and Sell StockeasyArrayDynamic Programming24 companies
- Insert Delete GetRandom O(1)mediumArrayHash TableMathDesign+124 companies
- Course Schedule IImediumDepth-First SearchBreadth-First SearchGraph TheoryTopological Sort24 companies
- Meeting Rooms IImediumArrayTwo PointersGreedySorting+223 companies
- Course SchedulemediumDepth-First SearchBreadth-First SearchGraph TheoryTopological Sort+123 companies
- Word LadderhardHash TableStringBreadth-First SearchBidirectional Search22 companies
- Longest Palindromic SubstringmediumTwo PointersStringDynamic ProgrammingManacher21 companies
- Koko Eating BananasmediumArrayBinary Search21 companies
- Median of Two Sorted ArrayshardArrayBinary SearchDivide and Conquer20 companies
- String CompressionmediumTwo PointersString20 companies
- Minimum Window SubstringhardHash TableStringSliding Window20 companies
- Spiral MatrixmediumArrayMatrixSimulation20 companies
- Search in Rotated Sorted ArraymediumArrayBinary Search20 companies
- House RobbermediumArrayDynamic Programming20 companies
- Basic Calculator IImediumMathStringStack19 companies
- Sliding Window MaximumhardArrayQueueSliding WindowHeap (Priority Queue)+219 companies
- Word SearchmediumArrayStringBacktrackingDepth-First Search+119 companies
- Longest Consecutive SequencemediumArrayHash TableUnion-Find19 companies
- Add Two NumbersmediumLinked ListMathRecursion18 companies
- Design Circular QueuemediumArrayLinked ListDesignQueue18 companies
- Design Hit CountermediumArrayBinary SearchDesignQueue+118 companies
- Maximal SquaremediumArrayDynamic ProgrammingMatrix18 companies
- Maximum SubarraymediumArrayDivide and ConquerDynamic Programming18 companies
- LFU CachehardHash TableLinked ListDesignDoubly-Linked List18 companies
- Kth Largest Element in an ArraymediumArrayDivide and ConquerSortingHeap (Priority Queue)+118 companies
- Asteroid CollisionmediumArrayStackSimulation17 companies
- Basic CalculatorhardMathStringStackRecursion17 companies
- Decode StringmediumStringStackRecursion17 companies
- Find First and Last Position of Element in Sorted ArraymediumArrayBinary Search17 companies
- Implement Trie (Prefix Tree)mediumHash TableStringDesignTrie17 companies
- Rotate ImagemediumArrayMathMatrix17 companies
- Product of Array Except SelfmediumArrayPrefix Sum17 companies
- Coin ChangemediumArrayDynamic ProgrammingBreadth-First SearchKnapsack Problem+117 companies
- 3SummediumArrayTwo PointersSorting17 companies
- Merge Two Sorted ListseasyLinked ListRecursion17 companies
- Random Pick with WeightmediumArrayMathBinary SearchPrefix Sum+116 companies
Listings only — titles, difficulty, and tags link out to LeetCode. Imported from the leetcode-company-wise-problems snapshot dated 1 June 2025. Frequency is that dataset's own relative score within a company and time range.