call(back)

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.

Max Width

Algorithms & Data Structures · Greedy line packing and fiddly space math — full text justification.

hardSign in to star problems

Debounce

Frontend · Closures and timers, the frontend screen classic.

easySign in to star problems

Top Earners per Department

SQL & Data · Window functions beat self-joins — know why.

mediumSign in to star problems

Design a Rate Limiter

System Design · Token bucket, sliding window, and where the counters live.

mediumSign in to star problems

Design a URL Shortener

System Design · The classic: encoding, storage, and redirects at scale.

mediumSign in to star problems

Design a News Feed

System Design · Fan-out on write vs. read, ranking, and the celebrity problem.

hardSign in to star problems

Tell Me About a Conflict

Behavioral · The most common behavioral prompt, told in STAR: a disagreement where you changed the outcome, or changed your mind.

mediumSign in to star problems

Round Numeric Strings I

Algorithms & Data Structures · Arbitrary-precision rounding — floats need not apply.

mediumSign in to star problems

Violation Log Analyzer

Algorithms & Data Structures · Streaming design: recent counts, top-k, and sliding-window bans.

mediumSign in to star problems

Nested Set Equality

Algorithms & Data Structures · Order and duplicates vanish at every depth — canonicalize.

mediumSign in to star problems

Assign Pins to Shortest Columns

Algorithms & Data Structures · The masonry-layout greedy: shortest column wins, leftmost on ties.

mediumSign in to star problems

Collect Pins from Reachable Boards

Algorithms & Data Structures · BFS over the bipartite pin-board graph without building board-to-board edges.

hardSign in to star problems

Chunked Stream Reader I

Algorithms & Data Structures · Reassemble lines from arbitrary chunks, reading lazily.

hardSign in to star problems

Escape-Room Leaderboard

Algorithms & Data Structures · Advance players in O(1), rank them without sorting — a linked list per room.

mediumSign in to star problems

Experiment Buckets I

Algorithms & Data Structures · Meet new group sizes while disrupting as few buckets as possible.

mediumSign in to star problems

Experiment Buckets II

Algorithms & Data Structures · Interval sweep for the free ranges — independent of bucket-space size.

mediumSign in to star problems

ID Allocator I

Algorithms & Data Structures · Smallest-free allocation under a capacity that moves at runtime.

mediumSign in to star problems

Cross-Reference Logs to Flag Spam Numbers

Algorithms & Data Structures · A hash join across two logs — and saying that word out loud.

mediumSign in to star problems

Sparse Matrix Storage, Addition, and Multiplication

Algorithms & Data Structures · Storage proportional to nonzeros — and the cancellation trap.

mediumSign in to star problems

Select the Nearest Eligible Elevator

Algorithms & Data Structures · A requirements-gathering problem wearing a simulation costume.

easySign in to star problems

Decide Target via Subsequence Plus/Multiply Expression

Algorithms & Data Structures · Expression search with precedence — the (total, pending product) trick.

hardSign in to star problems

Compute Reachable Cells for a Cleaning Robot

Algorithms & Data Structures · Slide-until-blocked physics: rest positions are the states, not cells.

mediumSign in to star problems

Maximize Boxes Stored Through One Entrance

Algorithms & Data Structures · Prefix-min ceilings plus an exchange-argument greedy.

mediumSign in to star problems

Mark and Compact a Heap-Indexed Subtree

Algorithms & Data Structures · Garbage collection in miniature: mark a subtree, compact, remap.

mediumSign in to star problems

Implement Single-Tab Browser History Navigation

Algorithms & Data Structures · A cursor over one visit stack: truncate forward history, clamp at both ends.

mediumSign in to star problems

Build a Counter

Frontend · The React warm-up: state, events, and a derived disable.

easySign in to star problems

Build a Todo List

Frontend · List state done right: keys, controlled input, and deletes.

mediumSign in to star problems

Build Tabs

Frontend · One active index drives the whole component.

easySign in to star problems

Build an Accordion

Frontend · Independent toggles — a Set of open ids, not N booleans.

mediumSign in to star problems

ID Allocator II

Algorithms & Data Structures · Pack named ID ranges, then resize with all-or-nothing shifts.

mediumSign in to star problems

Settle Debts I

Algorithms & Data Structures · Net the balances, then match debtors to creditors greedily.

mediumSign in to star problems

Reconstruct Itinerary I

Algorithms & Data Structures · Use every ticket once: Hierholzer's walk, smallest destination first.

hardSign in to star problems

Access-Log Query System

Algorithms & Data Structures · Two sorted indexes and a binary search you write by hand.

mediumSign in to star problems

Bus Routes: Minimum Transfers

Algorithms & Data Structures · BFS over routes, not stops — clear each stop as you expand it.

hardSign in to star problems

Exact Board Jumps I

Algorithms & Data Structures · Two out-edges per index: a graph search with a visited array.

easySign in to star problems

Restaurant Seating: Free Intervals

Algorithms & Data Structures · A +ppl/−ppl sweep; occupancy is constant between events.

mediumSign in to star problems

Count Pins on a Two-Column Screen

Algorithms & Data Structures · Only n scroll offsets matter — slide the window to a pin's top.

mediumSign in to star problems

Count Subarrays with Score Below K

Algorithms & Data Structures · Positives make sum × length monotone — a two-pointer window.

mediumSign in to star problems

Count Objects in a Pixel Grid via an API

Algorithms & Data Structures · Flood fill through an opaque API — isSameObject is the catch.

mediumSign in to star problems

Roads with Switches

Algorithms & Data Structures · Open roads cost 0, closed cost 1 — textbook 0-1 BFS.

mediumSign in to star problems

Bank Tellers I

Algorithms & Data Structures · A min-heap of (free time, agent) — tuple order breaks the ties.

mediumSign in to star problems

Prefix Search I

Algorithms & Data Structures · lower_bound on the prefix itself, then one startswith check.

easySign in to star problems

Stateful Search Autocomplete Session

Algorithms & Data Structures · A typing session over search counts: top three by frequency, then alphabetically.

hardSign in to star problems

Reverse Count-and-Say I

Algorithms & Data Structures · Parse (count, digit) pairs backward — adjacent runs must differ.

hardSign in to star problems

Design Pinterest's Home Feed

System Design · Recsys serving, not a social timeline — retrieval funnels, session state, four nines.

hardSign in to star problems

Design a Notification System

System Design · Fan-out, viral-pin aggregation under skew, and deciding not to send.

hardSign in to star problems

Design Search Typeahead

System Design · Tries with precomputed top-k, prefix sharding, and freshness by atomic swap.

mediumSign in to star problems

Design an Ads Event Reporting System

System Design · Streaming for dashboards, batch for billing truth — and hot keys from viral ads.

hardSign in to star problems

Design a Merchant Catalog Update Pipeline

System Design · Idempotent bulk ingestion with per-item ordering, fairness, and safe deletions.

mediumSign in to star problems

Design Image Upload and Serving for Pins

System Design · Presigned uploads, content-addressed variants, and a CDN that caches forever.

mediumSign in to star problems

Design the Pins and Boards Data Model

System Design · Sharding a relational model: object tables, mapping tables, no cross-shard joins.

mediumSign in to star problems

Design Visual Search

System Design · Embeddings, sharded ANN retrieval, and fresh pins searchable in seconds.

hardSign in to star problems

Design a Blob Storage Service

System Design · Metadata plane vs data plane, chunk replication, and the atomic-commit moment.

mediumSign in to star problems

Team Photo I

Algorithms & Data Structures · Sort both teams, pair i-th against i-th, and try both orders.

easySign in to star problems

Largest Sensor Distance

Algorithms & Data Structures · The largest nearest-sensor gap — sort one side, binary search from the other.

mediumSign in to star problems

Surveillance Footage I

Algorithms & Data Structures · Interval greedy: extend coverage with the farthest-reaching clip that still connects.

mediumSign in to star problems

Shortest Path Around Obstacles

Algorithms & Data Structures · Unit steps on a grid: BFS, and the first arrival is the answer.

mediumSign in to star problems

Sensor Network I

Algorithms & Data Structures · Union-Find: an edge whose endpoints already share a root closes a cycle.

easySign in to star problems

Rod Cutting I

Algorithms & Data Structures · Unbounded knapsack in disguise — say that out loud, then roll a 1-D table.

mediumSign in to star problems

Brace Expansion I

Algorithms & Data Structures · Tokenize into groups of choices, then fold a cartesian product across them.

mediumSign in to star problems

Nested-Transaction KV Store

Algorithms & Data Structures · An undo log per open transaction: rollback replays it, commit hands it to the parent.

mediumSign in to star problems

Replace Without Built-ins

Algorithms & Data Structures · Two-pointer scans with no library calls — the point is proving you can.

easySign in to star problems

Drone Zone Sensor

Algorithms & Data Structures · Injected transport, upserts keyed by id, a dirty set — a small class with senior signals.

easySign in to star problems

StoreData with Change Listeners

Frontend · A Backbone.Model-style store: two Maps, one event-key normalizer, listeners that can't break each other.

mediumSign in to star problems

Implement a Promise

Frontend · A one-way state machine, a handler queue, and every callback in a microtask.

hardSign in to star problems

Debounce with Cancel and Flush

Frontend · A trailing-edge debounce whose wrapper can also drop the pending call or run it now.

mediumSign in to star problems

Input Validation

Frontend · Declarative rule factories and one message per field — the first failing rule's.

easySign in to star problems

In-Memory File System

Algorithms & Data Structures · A tree of nodes keyed by path segment — the OOD-style prompt where the implementation is the test.

mediumSign in to star problems

Pour Water I

Algorithms & Data Structures · Simulate one unit at a time — left, then right, else stay — and land only on strictly lower ground.

mediumSign in to star problems

Tabs: initTabs(node)

Frontend · A tab UI packaged as an initializer — two independent instances from one function.

mediumSign in to star problems

Star Rating in a Form

Frontend · Real radio inputs behind the stars: the form submits itself, the keyboard works, N instances are N names.

mediumSign in to star problems

Shuffle and Deal Five Cards

Frontend · Fisher–Yates, a splice, and fresh nodes per deal — the reveal animation comes free.

mediumSign in to star problems

Typeahead with Keyboard Navigation

Frontend · Debounce the query, abort the stale request, cache by query, wrap the arrow keys, wire the combobox.

hardSign in to star problems

Carousel with a Per-Slide Countdown

Frontend · One interval per slide, one batched update per advance — and the double-advance trap.

mediumSign in to star problems

Connect Four

Frontend · Immutable board updates, gravity in dropPiece, and a win check that only looks through the last move.

mediumSign in to star problems

Pair Sum in a Sorted Array

Algorithms & Data Structures · The two-pointer warm-up: one pointer at each end.

easySign in to star problems

Course Schedule

Algorithms & Data Structures · Cycle detection dressed up as a scheduling question.

mediumSign in to star problems

Boxed Sentences I

Algorithms & Data Structures · Greedy word wrap inside ASCII borders — never split a word, never start a line with punctuation.

easySign in to star problems

URL Query-String Parser

Algorithms & Data Structures · Split first, decode second — the ordering that makes the encoded-ampersand case work.

easySign in to star problems

Review Token Tagging

Algorithms & Data Structures · Case-insensitive, longest match wins, original text preserved — a trie walk from every offset.

mediumSign in to star problems

Retry Wrapper

Algorithms & Data Structures · Pluggable backoff, a retryable filter, hooks, and an abort signal around one loop.

mediumSign in to star problems

FIFO Order Allocator

Algorithms & Data Structures · Consume the oldest stock first and say which lots an order drew from — an implementation prompt with tie-break rules.

mediumSign in to star problems

Transfer List

Frontend · Two arrays and one Set of checked ids — get a working version fast, then polish.

mediumSign in to star problems

Access-Log Request Metrics

Algorithms & Data Structures · Parse, validate, count — and pick the right denominator for the failure rate.

mediumSign in to star problems

Memory-Bounded Ranked Ballot Counter

Algorithms & Data Structures · Millions of ballots, Borda scoring, and memory that stays O(candidates) — the constraint is the question.

mediumSign in to star problems

Top-N Frequent Log Lines

Algorithms & Data Structures · Bucket sort when the multiset fits, a size-N heap when it's a stream — say both.

mediumSign in to star problems

Synonym Groups

Algorithms & Data Structures · "Bidirectional and transitive" means connected components — union-find, keyed by the smallest word.

mediumSign in to star problems

Number of Islands

Algorithms & Data Structures · Flood fill from every unvisited land cell — and know when DFS, BFS or union-find fits.

mediumSign in to star problems

Insert Interval

Algorithms & Data Structures · Three linear phases instead of a re-sort: before, overlapping, after.

mediumSign in to star problems

Design HashMap

Algorithms & Data Structures · Separate chaining with a resize at a load-factor threshold — fixed buckets aren't enough.

mediumSign in to star problems

Design Task Manager

Algorithms & Data Structures · A heap cannot update a key — push the new entry and discard stale ones at pop time.

mediumSign in to star problems

Unit Conversion I

Algorithms & Data Structures · One DFS from the base unit multiplies factors down the tree, modulo a prime.

mediumSign in to star problems

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).

mediumSign in to star problems

Sliding-Window Rate Limiter

Algorithms & Data Structures · A queue of admitted timestamps per key: evict what aged out, admit while under the limit.

mediumSign in to star problems

Lazy Nested-List Iterator

Algorithms & Data Structures · Flatten behind hasNext/next with O(depth) memory — and survive [[], [[]], [[], [3]]].

mediumSign in to star problems

Reservoir Sampling

Algorithms & Data Structures · One pass and O(k) memory: item i replaces a random slot with probability k/(i+1).

mediumSign in to star problems

Median of a Stream I

Algorithms & Data Structures · Two heaps — a max-heap for the lower half, a min-heap for the upper — rebalanced on every add.

hardSign in to star problems

Precision, Recall and F1

Algorithms & Data Structures · Three guarded divisions — and 0 wherever a denominator is 0.

easySign in to star problems

Implement MapReduce

Algorithms & Data Structures · Map, combine, partition, sort, reduce — the three parts a groupby does not have are the whole grade.

mediumSign in to star problems

Hotel Booking System

Algorithms & Data Structures · Half-open intervals per room, only neighbours can clash — and check-then-book must be one atomic step.

mediumSign in to star problems

Voting System API

Algorithms & Data Structures · Idempotent writes, a separate read model, and an audit log — all three in one small service.

mediumSign in to star problems

Basic Calculator II

Algorithms & Data Structures · One pass with a stack of signed terms; the trap is integer division truncating toward zero.

mediumSign in to star problems

Sorted List to Balanced BST

Algorithms & Data Structures · Build in-order and pull values off a forward-only iterator — no middle-finding, no array copy.

mediumSign in to star problems

Word Search on a Letter Grid

Algorithms & Data Structures · Build the trie first and say why: it prunes the DFS the moment a prefix does not exist.

hardSign in to star problems

Capture Stones on a Go Board

Algorithms & Data Structures · A group dies exactly when it has no adjacent empty point — flood fill each neighbouring enemy group.

mediumSign in to star problems

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.

hardSign in to star problems

Design an ML Evaluation Platform

System Design · Versioned benchmarks, cached (model, item) runs, and confidence intervals — presented as a spoken walkthrough.

hardSign in to star problems

Socket Reader II

Algorithms & Data Structures · TCP is a byte stream: buffer across calls, frame by length prefix, and tell a clean EOF from a truncated message.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

Design a File Sync Service

System Design · Content-addressed blocks, a per-namespace journal, and conflicted copies instead of silent loss.

mediumSign in to star problems

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.

hardSign in to star problems

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.

mediumSign in to star problems

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.

hardSign in to star problems

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.

hardSign in to star problems

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.

hardSign in to star problems

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.

hardSign in to star problems

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.

hardSign in to star problems

Merge Overlapping Intervals

Algorithms & Data Structures · Sort, then sweep — the pattern behind a dozen calendar problems.

mediumSign in to star problems

LRU Cache

Algorithms & Data Structures · Hash map plus doubly linked list, all operations O(1).

mediumSign in to star problems

Valid Sudoku

Algorithms & Data Structures · One pass, three sets — and derive the box index out loud instead of asserting it.

easySign in to star problems

Is Graph Bipartite?

Algorithms & Data Structures · Two-colour with BFS from every unvisited node; an odd cycle is the only way to fail.

mediumSign in to star problems

Group Anagrams

Algorithms & Data Structures · A 26-count key instead of sorting each word — the only decision in the problem.

easySign in to star problems

Word Ladder

Algorithms & Data Structures · BFS, not DFS — shortest path — then mention bidirectional BFS, which roughly square-roots the frontier.

hardSign in to star problems

Implement Array.prototype.flat

Frontend · Depth, holes and Infinity — without recursion, so 100,000 levels can't overflow the stack.

mediumSign in to star problems

Implement Array.prototype.map

Frontend · Pre-size the output so holes stay holes, and forward thisArg.

easySign in to star problems

Run Promises in Sequence

Frontend · Take functions, not promises — then never call the next task until the previous one settles.

mediumSign in to star problems

mapAsync II

Frontend · A sliding window of N workers: results in input order, nothing new after a failure.

mediumSign in to star problems

Create and Consume a Promise

Frontend · A promise that settles after a second, rejecting with an Error — then consumed with await and try/catch.

easySign in to star problems

Inheritance Without class

Frontend · Explain the prototype chain, then rebuild a class ... extends pair from constructor functions, without the new Parent() trap.

easySign in to star problems

Implement cloneDeep

Frontend · Cycles, shared references, Date, RegExp, Map, Set, prototypes and symbol keys: everything spread and JSON get wrong.

mediumSign in to star problems

Implement memoize

Frontend · A closure over a Map keyed on every argument — and has, not truthiness, so 0 and undefined still hit.

mediumSign in to star problems

Implement Lodash's get

Frontend · Read a nested value by path, and return the fallback only when it is missing, never when it is merely falsy.

easySign in to star problems

Implement Lodash's chunk

Frontend · Step by size and slice — after clamping the size, because 0 loops forever.

easySign in to star problems

Key Paths of a Nested Object

Frontend · The dotted path to every primitive in a nested object or array — even when the input has cycles.

easySign in to star problems

First Duplicate Character I

Algorithms & Data Structures · The first character whose second occurrence comes earliest — one pass with a set, emoji included.

easySign in to star problems

Unique Values Across Two Arrays I

Algorithms & Data Structures · Every value once, in first-seen order — a Set keeps insertion order.

easySign in to star problems

Array Products I

Algorithms & Data Structures · Prefix products left to right, suffix products right to left — no division, so zeros need no special case.

easySign in to star problems

Domain Operation Simulator

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.

mediumSign in to star problems

Min Stack

Algorithms & Data Structures · A second stack holds the minimum at each depth, so getMin is just its top.

easySign in to star problems

Parse an Integer Without parseInt

Algorithms & Data Structures · Sign, then digits through a lookup table, accumulating n * 10 + d — and NaN for anything else.

easySign in to star problems

Nested Tabs From a Flat List

Frontend · Turn { id, name, parentId } rows into a tree in one pass, then render every level as tabs under its parent.

mediumSign in to star problems

Masonry Layout in CSS

Frontend · Pack cards of different heights into tight columns with CSS alone, then explain what CSS-only masonry cannot do.

mediumSign in to star problems

Load CSS on Demand

Frontend · A promise around a <link>, memoized by href, that forgets failures so a retry can work.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

Six-Digit Code Input

Frontend · Six one-digit fields that feel like one: advance on entry, Backspace back, paste the whole code, lock while verifying.

mediumSign in to star problems

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>.

easySign in to star problems

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.

mediumSign in to star problems

Predict the State: A Redux Reducer

Frontend · Trace three dispatches through a reducer by hand — and read the case labels character by character.

easySign in to star problems

What Is a Closure?

Frontend · A function plus the bindings of the scope it was created in — bindings, not snapshots.

easySign in to star problems

What Is Event Bubbling?

Frontend · Capture down, target, bubble up — and why delegation depends on it.

easySign in to star problems

What Is CORS?

Frontend · Browsers block cross-origin reads unless the server opts in — it protects users, not servers.

easySign in to star problems

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.

mediumSign in to star problems

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.

hardSign in to star problems

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.

mediumSign in to star problems

Settle Debts II

Algorithms & Data Structures · Split the nonzero balances into as many zero-sum groups as possible.

hardSign in to star problems

Reconstruct Itinerary II

Algorithms & Data Structures · Rebuild the itinerary with Hierholzer's walk, then look for a repeat.

hardSign in to star problems

Exact Board Jumps II

Algorithms & Data Structures · BFS from the start: the layer where the last index appears is the answer.

mediumSign in to star problems

Bank Tellers II

Algorithms & Data Structures · The count served by time T is monotone — binary search T.

mediumSign in to star problems

Prefix Search II

Algorithms & Data Structures · Matches are contiguous: lower_bound the prefix, then the prefix bumped by one.

mediumSign in to star problems

Reverse Count-and-Say II

Algorithms & Data Structures · The reverse parse, memoized on (index, previous digit) — count, don't build.

hardSign in to star problems

Round Numeric Strings II

Algorithms & Data Structures · Split, round each value with string arithmetic, join — floats need not apply.

mediumSign in to star problems

Chunked Stream Reader II

Algorithms & Data Structures · Reassemble the lines, net the balances, then search for the fewest transfers.

hardSign in to star problems

Team Photo II

Algorithms & Data Structures · Only faced pairs matter: greedily match the smaller team into the larger.

mediumSign in to star problems

Team Photo III

Algorithms & Data Structures · The greedy match, written into two rows with empty slots.

mediumSign in to star problems

Fewest Towers to Cover Every Crossing

Algorithms & Data Structures · Greedy: place each tower as far right as the leftmost uncovered crossing allows.

mediumSign in to star problems

Distance Between Two Points

Algorithms & Data Structures · One formula for every dimension: the square root of the summed squared differences.

easySign in to star problems

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.

mediumSign in to star problems

Shortest Path with Terrain Costs

Algorithms & Data Structures · Unequal step costs turn BFS's queue into Dijkstra's priority queue.

mediumSign in to star problems

Brace Expansion II

Algorithms & Data Structures · A three-line grammar turns nested braces into a tiny recursive-descent parser.

hardSign in to star problems

Run-Length Encode and Decode

Algorithms & Data Structures · Find the end of each run (or each number), emit, jump.

easySign in to star problems

String Compression in Place

Algorithms & Data Structures · A read pointer and a write pointer over the same array — write never passes read.

mediumSign in to star problems

Surveillance Footage II

Algorithms & Data Structures · The farthest-reach greedy again, remembering which clip won each round.

mediumSign in to star problems

Surveillance Footage III

Algorithms & Data Structures · Sweep sorted clips tracking the farthest end; a start past it opens a gap.

easySign in to star problems

Sensor Network II

Algorithms & Data Structures · Start at n components; every successful union merges two into one.

easySign in to star problems

Sensor Network III

Algorithms & Data Structures · Kahn's algorithm: peel sensors with no pending inputs; leftovers mean a cycle.

mediumSign in to star problems

Rod Cutting II

Algorithms & Data Structures · The rod-cutting table again, charging for every cut and seeding the whole-rod sale.

mediumSign in to star problems

Rod Cutting III

Algorithms & Data Structures · Add a piece-count dimension: dp[k][L] builds on dp[k − 1][L − p].

mediumSign in to star problems

Median of a Stream II

Algorithms & Data Structures · Buckets plus underflow and overflow: O(1) adds, any quantile, error within half a bucket.

mediumSign in to star problems

Sessionize Events by Entity

Algorithms & Data Structures · Sort by (entity, time), then extend or open one session per entity in a single sweep.

mediumSign in to star problems

Unit Conversion II

Algorithms & Data Structures · Convert through the base unit — and divide with a modular inverse, since you can't divide mod p.

hardSign in to star problems

Token-Bucket Rate Limiter

Algorithms & Data Structures · Store (tokens, last seen) per key and refill lazily on each call — O(1) per key.

mediumSign in to star problems

Compound Iterator

Algorithms & Data Structures · Chain iterables behind hasNext/next with a lookahead that skips the empty ones.

easySign in to star problems

Weighted Sampling Without Replacement

Algorithms & Data Structures · A-Res: key each item by random()^(1/weight) and keep the k largest keys.

hardSign in to star problems

Stratified Sampling with Largest-Remainder Allocation

Algorithms & Data Structures · Floor each proportional share, give leftovers to the largest remainders, sample within each stratum.

hardSign in to star problems

NDCG@k

Algorithms & Data Structures · Discount each graded relevance by log2(position + 2), then divide by the ideal ordering's DCG.

mediumSign in to star problems

Cohen's Kappa

Algorithms & Data Structures · Observed agreement corrected for the agreement two annotators would reach by chance.

mediumSign in to star problems

Unbiased pass@k

Algorithms & Data Structures · 1 − C(n − c, k) / C(n, k), computed as a running product so nothing overflows.

mediumSign in to star problems

Socket Reader I

Algorithms & Data Structures · Buffer bytes across recv calls, split on newlines, and decode only whole lines.

mediumSign in to star problems

Implement groupBy

Frontend · Group items by key into a null-prototype object — because {} already has "constructor".

easySign in to star problems

First Duplicate Character II

Algorithms & Data Structures · Where the earliest second occurrence sits — the same set scan, returning an index.

easySign in to star problems

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.

easySign in to star problems

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.

easySign in to star problems

Multiply Without *

Algorithms & Data Structures · Binary long multiplication: add the doubled multiple for every set bit — and double with +=, not a 32-bit shift.

easySign in to star problems

Implement Array.prototype.filter

Frontend · Skip holes, forward thisArg, and keep the elements whose callback is truthy.

easySign in to star problems

Implement Array.prototype.reduce

Frontend · A missing initial value versus an undefined one — and the TypeError when there's nothing to reduce.

mediumSign in to star problems

Implement Array.prototype.concat

Frontend · Spread arrays and isConcatSpreadable objects one level, keep holes, append everything else.

mediumSign in to star problems

Drive a Generator Like async/await

Frontend · Resume the generator with each resolved value, and throw each rejection back in at the yield.

mediumSign in to star problems

mapAsync I

Frontend · Start every call at once and let Promise.all keep the input order.

easySign in to star problems

Implement Promise.all

Frontend · Store results by index, count down, resolve an empty input at once, reject on the first failure.

mediumSign in to star problems

Promise With a Timeout

Frontend · Race the promise against a timer — and clear the timer when the promise wins.

mediumSign in to star problems

Implement curry

Frontend · Collect arguments until fn.length have arrived — with a fresh array per call so partials stay independent.

mediumSign in to star problems

Implement once

Frontend · A called flag, not a check on the result — and the first call's this and arguments.

easySign in to star problems

Array Products II

Algorithms & Data Structures · Each position multiplies its two successors, wrapping around the end with modular indices.

easySign in to star problems

Count Each Character in First-Seen Order

Algorithms & Data Structures · One counting pass into a Map, emitted in insertion order: AAABBAA becomes 5A2B.

easySign in to star problems

Sum 1 to n Recursively

Algorithms & Data Structures · A base case at n <= 0 and one recursive call — then say where the call stack runs out.

easySign in to star problems

Square Root Without Math.sqrt

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.

easySign in to star problems

An Exact Fibonacci Generator

Algorithms & Data Structures · An infinite generator over two BigInts — ordinary numbers lose precision past the 78th term.

easySign in to star problems

A Tooltip Library From data Attributes

Frontend · One tooltip node, delegated listeners, keyboard focus and Escape — in plain DOM, not a component.

mediumSign in to star problems

Predict the Output: What a Spread Copies

Frontend · { ...first } copies the top level only — a nested object stays shared.

easySign in to star problems

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.

easySign in to star problems

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.

easySign in to star problems

Predict the Output: A then and finally Chain

Frontend · A promise settles once, finally passes values through, and a rejection handler can recover.

mediumSign in to star problems

Predict the Output: var Hoisting With Shadowing

Frontend · A var inside the function is hoisted and initialized to undefined, shadowing the outer one.

easySign in to star problems

Predict the Result: Type Coercion

Frontend · What adding "0" to a number does, and a table of +, == and comparison gotchas.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

easySign in to star problems

Predict the Output: Nested Context Providers

Frontend · Default value, nearest provider, and why memo doesn't stop a context update.

mediumSign in to star problems

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.

easySign in to star problems

Which Statement About React Context Is Correct?

Frontend · Context in React 16.3 and later: how it's created and who can read it.

easySign in to star problems

What Are the States of a Promise?

Frontend · Pending, then fulfilled or rejected — settled is final, and handlers always run later.

easySign in to star problems

What Were the Best Improvements in ES6?

Frontend · Pick two features and say which bug each one removed.

easySign in to star problems

Inheritance or Composition?

Frontend · "Is a" ties the child to the parent; "has a" combines small parts.

easySign in to star problems

What Is Endianness?

Frontend · The byte order of multi-byte values — and where JavaScript makes you care.

easySign in to star problems

What Do Object-Oriented Languages Share?

Frontend · Encapsulation, inheritance and polymorphism — and how JavaScript gets inheritance.

easySign in to star problems

Cookies, localStorage or sessionStorage?

Frontend · Size, lifetime and who can read it — HttpOnly cookies survive XSS.

easySign in to star problems

How Do You Secure a Site?

Frontend · HTTPS, CSP, cookie flags and escaping — each named with the attack it stops.

mediumSign in to star problems

Axios or fetch?

Frontend · fetch resolves on a 500; Axios rejects, parses JSON and intercepts.

easySign in to star problems

What Do You Think of GraphQL?

Frontend · One round trip and typed data, paid for in caching, query cost and N+1 resolvers.

mediumSign in to star problems

How Do You Build an npm Package?

Frontend · package.json fields, ESM builds with types, peer dependencies, and a dry-run before publishing.

easySign in to star problems

What Makes a Good Code Review?

Frontend · Correctness first, then readability and tests — small diffs, specific comments.

easySign in to star problems

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.

easySign in to star problems

Have You Used Jest?

Frontend · Name what you test with it — including timers with fake timers.

easySign in to star problems

When Would You Use useMemo or useCallback?

Frontend · They cache a value and a function identity — and only matter when something compares them.

mediumSign in to star problems

preventDefault or stopPropagation?

Frontend · One cancels the browser's default action; the other stops the event traveling.

easySign in to star problems

Why <!DOCTYPE html>, and What Is Quirks Mode?

Frontend · The doctype selects standards mode; without it, browsers emulate 1990s layout.

easySign in to star problems

What Is a Compositing Layer?

Frontend · A GPU texture the compositor can move or fade without layout or paint.

mediumSign in to star problems

How Do You Make a Page Accessible?

Frontend · Native elements first, then names, keyboard, contrast, motion — and a real example.

mediumSign in to star problems

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.

easySign in to star problems

How Do You Adjust a Border or a Margin?

Frontend · Content, padding, border, margin — and what border-box changes about width.

easySign in to star problems

What Is an API?

Frontend · A contract for how one piece of software calls another.

easySign in to star problems

How Does the Browser Turn HTML Into Pixels?

Frontend · DOM, CSSOM, render tree, layout, paint, composite — six numbered steps.

mediumSign in to star problems

Repaint or Reflow?

Frontend · Which pipeline steps each kind of change re-runs — and how reads force layout.

mediumSign in to star problems

What Are FCP and LCP?

Frontend · First Contentful Paint and Largest Contentful Paint, with their good thresholds.

easySign in to star problems

How Would You Debug a Blank Page?

Frontend · Console, network, DOM, then bisect the deploys.

easySign in to star problems

How Would You Make a Site Faster?

Frontend · Measure first, then ship less, unblock rendering, cache, and move work.

mediumSign in to star problems

How Do You Deal With a Slow API?

Frontend · Show a shell at once, cache and parallelize, cancel stale requests — then fix the server.

easySign in to star problems

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.

mediumSign in to star problems

Pour Water II

Algorithms & Data Structures · Levels from the top down, one character per column — ground, water, or air.

easySign in to star problems

Abortable Promise

Frontend · Promises can't be cancelled, so cancel the work — and reject once, with an AbortError, only while pending.

mediumSign in to star problems

Implement Throttle

Frontend · A leading call, then at most one call per window — with a trailing call that carries the latest arguments.

mediumSign in to star problems

Boxed Sentences II

Algorithms & Data Structures · Each sentence wraps at its own width; one box pads every line to the widest.

easySign in to star problems

Classify a Poker Hand

Algorithms & Data Structures · A rank histogram and two booleans name every category — the ace is the only edge case.

easySign in to star problems

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.

mediumSign in to star problems

People and Cakes I

Algorithms & Data Structures · One pass and two remembered indexes — the last person and the last cake seen.

easySign in to star problems

People and Cakes II

Algorithms & Data Structures · Nearest-cake greedy is wrong; with both lists sorted, an optimal matching never crosses, so a 2-D DP finds it.

mediumSign in to star problems

Course Completion Time I

Algorithms & Data Structures · Courses run in waves, and a wave takes as long as its slowest course.

mediumSign in to star problems

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.

hardSign in to star problems

DAG Permissions I

Algorithms & Data Structures · Topological order with a 26-bit mask per node: inherited = AND of the parents, final = (inherited OR allow) AND NOT disallow.

mediumSign in to star problems

Wiki Page Links I

Algorithms & Data Structures · BFS over an implicit graph, fetching each page exactly once.

mediumSign in to star problems

Wiki Page Links II

Algorithms & Data Structures · Store one predecessor per page, not a path per queue entry, and walk it back from the target.

mediumSign in to star problems

Wiki Page Links III

Algorithms & Data Structures · A BFS that keeps going after the target is gone — and the thread-safety story that comes with it.

mediumSign in to star problems

Dropped Requests Under Two Rules

Algorithms & Data Structures · One queue of accepted timestamps per rule; dropped requests never enter either.

mediumSign in to star problems

Tiered Token-Bucket Limiter

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.

mediumSign in to star problems

Count Events in a Time Range

Algorithms & Data Structures · Timestamps arrive in order, so each type's list is already sorted and a count is two binary searches.

easySign in to star problems

SnowCal Interpreter

Algorithms & Data Structures · One register, a dictionary of recorded bodies, and a mode flag that says whether a line runs or is being stored.

mediumSign in to star problems

Priority Task Executor

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.

mediumSign in to star problems

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.

mediumSign in to star problems

Reverse Each Alphanumeric Run

Algorithms & Data Structures · Two pointers per run: find where the run ends, reverse it in place, carry on from there.

easySign in to star problems

Grep With Context Lines

Algorithms & Data Structures · Turn each match into a clipped line range, merge ranges that touch, and print a separator between the groups left.

mediumSign in to star problems

JSON Parser

Algorithms & Data Structures · Recursive descent with one cursor: a value function that dispatches on the next character, and a parser per kind.

hardSign in to star problems

Document Store With Boolean Queries

Algorithms & Data Structures · An inverted index plus a tiny expression parser whose values are sets of document ids.

hardSign in to star problems

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.

easySign in to star problems

Valid Tic-Tac-Toe State

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.

mediumSign in to star problems

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.

easySign in to star problems

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.

mediumSign in to star problems

Sort Colours Through an API

Algorithms & Data Structures · Dutch national flag with three pointers, using only getColor and swap — one pass, no counting.

mediumSign in to star problems

Course Completion Time II

Algorithms & Data Structures · A course may start once any one prerequisite is done: swap the max for a min and relax in topological order.

mediumSign in to star problems

Tree Height After Deletions I

Algorithms & Data Structures · A deleted node hands its children to its nearest surviving ancestor, so it simply adds no level.

mediumSign in to star problems

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.

hardSign in to star problems

Minimum Bus Fleet

Algorithms & Data Structures · Meeting rooms with stations: a bus is reusable only where it arrived, so keep the idle buses per station.

mediumSign in to star problems

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.

mediumSign in to star problems

Is the Graph Three-Colourable?

Algorithms & Data Structures · Backtracking over the vertices: try each colour not used by a coloured neighbour, undo on failure.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

hardSign in to star problems

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.

hardSign in to star problems

Design an ACL Check Service

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.

mediumSign in to star problems

Design a Cloud Queue Service

System Design · Start from a Queue class, then make every step survive a client, server or network failure in the middle of it.

mediumSign in to star problems

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.

mediumSign in to star problems

Design an Audit Log Service

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.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

Design a Web Crawler at Scale

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.

mediumSign in to star problems

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.

mediumSign in to star problems

The Project You Are Most Proud Of

Behavioral · Your flagship story: the goal, your role, the hardest technical problem, and a measurable result.

mediumSign in to star problems

Your Most Complex Back-End Work

Behavioral · The same flagship project, told through its hardest design decision.

mediumSign in to star problems

Your Hardest Situation at Work

Behavioral · A deadline or an incident where you had to cut scope and manage risk.

mediumSign in to star problems

A Time You Pushed Back

Behavioral · Declining or reshaping a request, with the reasoning and the result.

mediumSign in to star problems

Delivering Under a Tight Deadline

Behavioral · What you did when the time was not enough: sequencing, trade-offs, communication.

mediumSign in to star problems

Mentoring Someone

Behavioral · How you helped someone grow, and how you knew it worked.

mediumSign in to star problems

One Piece of Advice for Your Team

Behavioral · A specific process or technical improvement, its impact, and how you would measure it.

mediumSign in to star problems

Why Are You Leaving, and Why Snowflake?

Behavioral · Growth you want next, tied to something concrete about the work here.

mediumSign in to star problems

How Do You Use AI Tools?

Behavioral · Named tools, the tasks you use them for, a rough share of your coding, and how you verify the output.

mediumSign in to star problems

What Is MVCC?

SQL & Data · Writers create new versions instead of overwriting, so readers see a consistent snapshot without blocking writers.

easySign in to star problems

LSM Tree vs B-Tree

SQL & Data · LSM buffers writes in memory and merges sorted files later; a B-tree updates in place for steadier reads.

easySign in to star problems

Row vs Columnar Storage

SQL & Data · Rows suit point lookups and transactions; columns suit scans and aggregates and compress far better.

easySign in to star problems

What Is Vectorized Execution?

SQL & Data · Operators process batches of column values instead of one row at a time, cutting interpretation overhead and using CPU caches well.

easySign in to star problems

What Is a Write-Ahead Log?

SQL & Data · Record the change durably before applying it, so a crash can be replayed.

easySign in to star problems

Transaction Isolation Levels

SQL & Data · Read committed, repeatable read, snapshot, serializable — know which anomaly each permits.

easySign in to star problems

Snowflake's Three Layers

SQL & Data · Database storage, independent compute warehouses, and a cloud services layer — a hybrid of shared-disk and shared-nothing.

easySign in to star problems

What Is a Micro-Partition?

SQL & Data · Immutable 50–500 MB columnar chunks created automatically, with per-column metadata that lets queries skip them.

easySign in to star problems

Two-Phase Commit

System Design · Prepare on all participants, then commit; it blocks if the coordinator dies after prepare.

easySign in to star problems

How Does Raft Work?

System Design · A leader replicates a log to a majority before committing; a new leader is elected by majority vote.

easySign in to star problems

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.

hardSign in to star problems

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.

easySign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

Course Schedule With Retries

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.

mediumSign in to star problems

Service-Failure Forensics

Algorithms & Data Structures · A failure is explained if something it depends on, transitively, failed first; the unexplained failures are the root causes.

mediumSign in to star problems

String-Command Calculator I

Algorithms & Data Structures · A recursive-descent parser: a command's operand is either an integer or a parenthesised sub-program evaluated from zero.

mediumSign in to star problems

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.

hardSign in to star problems

Serialize a Dictionary Trie

Algorithms & Data Structures · Pre-order with explicit end-of-word marks and parentheses around children; parsing it back is a recursive descent.

mediumSign in to star problems

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.

easySign in to star problems

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.

easySign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

hardSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

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.

mediumSign in to star problems

Rolling 7-Day Average Revenue

SQL & Data · A window frame of six preceding rows is right only when every day has a row; fill the calendar first.

mediumSign in to star problems

Extract Fields From a JSON Column

SQL & Data · Path into the document for scalars, cast them explicitly, and flatten arrays into rows before aggregating.

mediumSign in to star problems

Kanban Board

Frontend · Columns of cards with immutable moves: one pure moveCard function serves the buttons and the drag-and-drop alike.

mediumSign in to star problems

Grid Game: Lights Out

Frontend · State in one object, a pure toggle that flips a cell and its neighbours, one delegated click listener, and a render from state.

mediumSign in to star problems

Breadth-First Search Order

Algorithms & Data Structures · A queue with an index pointer, a visited set marked on enqueue, neighbours in the order given.

easySign in to star problems

Merge Sort

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.

mediumSign in to star problems

Dijkstra's Shortest Distances

Algorithms & Data Structures · A priority queue of tentative distances; a node's distance is final the first time it is popped.

mediumSign in to star problems

Implement an Event Emitter

Frontend · A map from event name to listener list; copy the list before emitting so listeners can unsubscribe mid-emit.

mediumSign in to star problems

Implement deepEqual

Frontend · Primitives by value (NaN equals NaN), arrays by length and elements, plain objects by key set and values, recursively.

mediumSign in to star problems

Implement JSON.stringify

Frontend · A recursive serializer with the real rules: undefined vanishes from objects but becomes null in arrays, and strings need escaping.

mediumSign in to star problems

Undo/Redo Manager

Frontend · Two stacks: a new value pushes the old one onto undo and clears redo; undo and redo move values between them.

mediumSign in to star problems

Chessboard in React

Frontend · Derive the 64 squares in render — no board in state — then add selection and a move with one piece of state.

easySign in to star problems

Robot Eats Candies on a Grid

Frontend · Keyboard movement with walls and edges, a breadth-first path to the nearest candy walked by a requestAnimationFrame loop, and a debounced hint, in plain JavaScript or React.

mediumSign in to star problems

Grid Lights

Frontend · Remember the order cells were lit; when all are lit, a self-re-arming timeout switches them off in reverse.

mediumSign in to star problems

Memory Game

Frontend · A shuffled deck, at most two face-up ids, a set of matched faces, and one effect that resolves each pair.

mediumSign in to star problems

Whack-a-Mole

Frontend · Two intervals owned by one effect keyed on the running flag, and a round that ends when the clock hits zero.

mediumSign in to star problems

Selectable Cells

Frontend · Two corners in state and a derived rectangle; pointer events on cells plus one document listener for the release.

mediumSign in to star problems

Pixel Art

Frontend · A flat array of 225 colours, a palette, draw and erase modes, and a stroke that paints while the pointer is held.

mediumSign in to star problems

Nested Checkboxes

Frontend · Store only the leaves; every parent's checked and indeterminate state is derived from the leaves beneath it.

mediumSign in to star problems

Data Table I

Frontend · Three pieces of state — page, page size, sort — and rows derived from them in render.

mediumSign in to star problems

File Explorer

Frontend · A recursive component over nested data, with a set of expanded ids as the only state.

mediumSign in to star problems

useDebounce Hook

Frontend · A state copy of the value and one effect whose cleanup cancels the pending update on every change.

easySign in to star problems

DAG Permissions II

Algorithms & Data Structures · Allows flow down from every ancestor and a disallow stays local: OR the parents' allow sets in topological order, then subtract the node's own disallow.

mediumSign in to star problems

DAG Permissions IV

Algorithms & Data Structures · Both allows and denies flow down the DAG as letter sets; a node's letters are its inherited allows minus its inherited denies.

mediumSign in to star problems

Subtree Pruning I

Algorithms & Data Structures · Deleting a node takes its subtree: walk down from the root, never entering a deleted node, and keep the deepest level reached.

easySign in to star problems

Subtree Pruning II

Algorithms & Data Structures · When nodes within the limit must stay, the only cuts that can be made are the first nodes past it — and each is a separate cut.

easySign in to star problems

Subtree Pruning III

Algorithms & Data Structures · One cut per root branch that is too deep, placed at the deepest node above all of that branch's offending nodes.

mediumSign in to star problems

Prerequisite Route to a Target Course

Algorithms & Data Structures · Collect the courses the target depends on, then order just those with a smallest-first topological sort; a cycle among them means no route.

mediumSign in to star problems

Repeated Lookups in a Sorted Array

Algorithms & Data Structures · Many queries against one sorted array: record each value's first index once and answer every query from that, never searching twice.

easySign in to star problems

Contiguous Recipe Lookup I

Algorithms & Data Structures · Many patterns, one text: a trie of the recipes with failure links finds every recipe in a single pass over the ingredients.

mediumSign in to star problems

Contiguous Recipe Lookup II

Algorithms & Data Structures · The ingredients arrive once and cannot be stored: the recipe automaton advances one state per element and never looks back.

hardSign in to star problems

DAG Permissions III

Algorithms & Data Structures · Two bits flow down the DAG, allowed and denied; a node has access when it inherited an allow and no deny.

easySign in to star problems

Recent Event Window Queries

Algorithms & Data Structures · Keep the newest m events in arrival order; a query counts over the prefix whose timestamps fit, which is small because m is.

mediumSign in to star problems

String-Command Calculator II

Algorithms & Data Structures · The commands become a prefix grammar: an expression is an integer or (OP expr expr), evaluated by recursive descent over the tokens.

mediumSign in to star problems

People and Cakes III

Algorithms & Data Structures · Two sweeps along the hallway — nearest cake on the left, nearest on the right — give every person a distance in one go.

easySign in to star problems

People and Cakes IV

Algorithms & Data Structures · A grid with no empty cells: if there is a person and a cake at all, some pair is adjacent, so the answer is 1 before any search.

easySign in to star problems

People and Cakes V

Algorithms & Data Structures · One person, every cake: scan the grid once keeping the cake with the smallest Manhattan distance.

easySign in to star problems

Design a Collaborative Spreadsheet (Front End)

System Design · A sparse cell map with formatting layers, a grid virtualised on both axes, dirty-subgraph recalculation over a dependency graph, and revisioned operations applied optimistically.

hardSign in to star problems

Design a Data Table Component (Front End)

System Design · A semantic table in one scroll container with a sticky header, a per-column contract, a width-resolution pipeline written to colgroup, and row virtualisation keyed by stable ids.

mediumSign in to star problems

Traffic Light

Frontend · One state value and one timeout per light, re-armed by an effect keyed on the colour; an interval can't do unequal durations.

easySign in to star problems

Data Table II

Frontend · Filters live in the column config and in one state object; rows are filtered, then sorted, then paged.

hardSign in to star problems

What Do You Check Before Calling a UI Component Done?

Frontend · The review you run on your own build: instances, state, HTML, forms, network, keyboard, edge cases, strings.

mediumSign in to star problems

Sign-Up Form

Frontend · Native attributes carry the rules, one message per field is linked by aria-describedby, and the button locks while the request is out.

mediumSign in to star problems

Like Button

Frontend · Three states the server confirms and one it hasn't: pending blocks a second click, failure shows its message, the label never changes.

mediumSign in to star problems

Windowed List

Frontend · One state value, scrollTop; a spacer as tall as the whole list; and only the rows under the viewport in the DOM, keyed by id.

mediumSign in to star problems

How Do You Approach a JavaScript Coding Question?

Frontend · Clarify the runtime and the edges, say which spec cases you are skipping, then dodge the one bug each classic is known for.

mediumSign in to star problems

Implement Function.prototype.bind

Frontend · A closure over thisArg and the leading arguments; the original runs later, with the call's own arguments appended.

easySign in to star problems

Implement classNames

Frontend · Strings and numbers pass through, objects add their truthy keys, arrays recurse, falsy values vanish, one space between.

easySign in to star problems

Implement Promise.allSettled

Frontend · Record every outcome by index as { status, value | reason }; it never rejects, and an empty input resolves at once.

mediumSign in to star problems

Implement Promise.any

Frontend · Resolve on the first fulfilment; reject only when every input has failed, with an AggregateError whose errors follow input order.

mediumSign in to star problems

Data Selection

Frontend · Merge per user with a Map re-inserted on every session so order follows the last one, then filter the merged rows.

hardSign in to star problems

Implement getElementsByTagName

Frontend · A depth-first walk over children comparing upper-cased tag names: document order for free, text nodes never seen.

mediumSign in to star problems

Retry With Exponential Backoff

Frontend · Try, wait, multiply the wait, try again: the first fulfilment wins, the last failure is the error, and no wait follows it.

mediumSign in to star problems

Boundary of a Full Binary Tree

Algorithms & Data Structures · With no missing children the two edges are plain spines: walk them and the leaves separately, and count the corners once.

mediumSign in to star problems

Workflow With Dependencies

Algorithms & Data Structures · Insertion-ordered tasks with a dependency set each: refuse an edge that would close a cycle, emit the earliest ready task, and copy both structures.

mediumSign in to star problems

Longest Common Substring

Algorithms & Data Structures · A table that resets to zero on a mismatch, so the answer is the largest cell rather than the corner, and one row of it is enough.

mediumSign in to star problems

Topological Sort

Algorithms & Data Structures · Kahn's algorithm with a min-heap in place of the queue: in-degrees, a frontier of ready nodes, and an empty result when a node never becomes ready.

mediumSign in to star problems

Happy Number Cycle

Algorithms & Data Structures · Iterate the digit-square sum until a value repeats; the loop is the path from that value's first visit, and a happy number's loop is just [1].

easySign in to star problems

Happy Numbers Up to N

Algorithms & Data Structures · One memo shared across every start: each value on a walk inherits the answer of where the walk stopped, so no value is followed twice.

easySign in to star problems

Unique Paths Grid Game

Frontend · A grid of obstacle toggles in a reducer, with the route count and one highlighted route derived from the grid rather than stored.

mediumSign in to star problems

TypeScript Kanban Board I

Frontend · Left and right arrows instead of drag-and-drop: one typed MOVE_TASK reducer action, and controls that disappear at the board's edges.

easySign in to star problems

TypeScript Kanban Board II

Frontend · Every moved task lands at the bottom of its new column: normalized state with one ordered ID list per status, then the board at 100,000 tasks.

mediumSign in to star problems

Filter Ads by a Single Rule

Algorithms & Data Structures · Optional location, minimum-age and maximum-age constraints combined with AND or OR; an absent constraint is ignored, and no constraint matches everything.

easySign in to star problems

Set Without a Hash Function

Algorithms & Data Structures · add, remove, contains and size on a fixed-length array you allocate yourself, growing and shrinking it; then how hashing values to indices would change the costs.

mediumSign in to star problems

Session Manager With Sliding Expiry

Algorithms & Data Structures · Unique tokens, validation that pushes the expiry forward, explicit revocation and an O(n) cleanup; an LRU cache with time as the key.

mediumSign in to star problems

Assign Each Flight a Runway

Algorithms & Data Structures · Runways are workers and flights are tasks: a heap of free times hands each flight, in start order, to the runway that frees up first.

mediumSign in to star problems

Rank Vectors by Cosine Similarity

Algorithms & Data Structures · Score every candidate against the query, keep the indices with the scores, sort descending; the zero vector needs a defined answer.

easySign in to star problems

When Do the Chasing Points Meet?

Algorithms & Data Structures · N points in a cycle each move at unit speed toward the next one; simulate with a step small enough that the meeting time is right to the hundredth.

mediumSign in to star problems

Elementwise Matrix Sum

Algorithms & Data Structures · The warm-up of the data-science screen: add two same-shaped matrices entry by entry, empty included.

easySign in to star problems

Name Frequency Count

Algorithms & Data Structures · Map each name to how many times it appears; the second warm-up of the data-science screen.

easySign in to star problems

Files and Folders Workspace

Algorithms & Data Structures · Create, list, delete and move resources in an in-memory tree: parent pointers for the upward checks, ordered child lists for the downward ones.

mediumSign in to star problems

Design a Flash Sale With a Virtual Queue

System Design · A waiting room that meters admission, stock that is decremented atomically under a hot key, and idempotency so retries never buy twice.

hardSign in to star problems

Design a Microblogging Dashboard From a Given Schema

System Design · Tweets, follows, likes and accounts tables are given; design the APIs, storage and the paginated top-X dashboard ranked by seven signals.

mediumSign in to star problems

Design Product Browse and Search for an Online Store

System Design · Catalog model, index schema and reindexing, query understanding, ranking and faceted browsing, and how search stays honest about price and stock at checkout.

hardSign in to star problems

Design a Global Multi-Game Leaderboard

System Design · Ranked views per game, region, season and friends that update right after a match: a rating algorithm, sorted sets for the read path, and idempotent result ingestion.

hardSign in to star problems

Design a Personalized Recommendation System

System Design · Logging to feature store to candidate generation to ranking to re-ranking, with cold start, evaluation and an A/B plan; the full pipeline for a streaming home feed.

hardSign in to star problems

Design a Clickstream Pipeline for a Billion Events a Day

System Design · Edge collectors into a durable log, stream processing for minute-fresh dashboards, batch for finalized daily aggregates, and the three follow-ups: lag, late data, exactly-once.

mediumSign in to star problems

Design an Analytics Pipeline, Then Take It Hybrid

System Design · Sources to landing zone to transforms to warehouse to BI, with named tools and alternatives at every stage; then the same design across on-prem and cloud, and on AWS versus Azure.

mediumSign in to star problems

Design a Shopping Cart (Front End)

System Design · Anonymous and signed-in carts across tabs and devices: a normalized client store, optimistic sync with idempotent writes, and the server as the source of truth for price and stock.

mediumSign in to star problems

Design a Feature Flag System (Front End)

System Design · Targeting by user, segment and percentage; delivery through a bootstrap plus an SDK with caching and push; consistent decisions across refreshes; defaults, dependencies and a kill switch.

mediumSign in to star problems

Design a Thread-Safe Batch Writer

System Design · Many threads submit records; one component buffers them and uses the database's batch API, flushing on size or time, holding the lock briefly, and draining cleanly on close.

mediumSign in to star problems

Movie List With Sort and Search

Frontend · Load a list from a fake endpoint with loading and error states, filter it by name as you type, and sort it by column with aria-sort; derive, do not store.

easySign in to star problems

Code Review: A Junior's React Change

Frontend · A working but fragile component to review out loud: what you flag first, how you say it so the author learns, what you would refactor, and what tests you ask for.

mediumSign in to star problems

Streaming Funnel by Impression Day

SQL & Data · Impression to click to signup to subscription with a time window at each hop, one count per user per impression day; windows join on the event before them, not the first one.

hardSign in to star problems

Most Enrolled Course

SQL & Data · A count per course over the join table, ordered with a deterministic tie-break and limited to one row; then where it goes in a Spring MVC service.

easySign in to star problems

Bug-Free and Buggy Submission Counts

SQL & Data · Conditional aggregation with SUM over CASE, a LEFT JOIN so silent employees still appear, and the NULL branch.

easySign in to star problems

Fast Submissions, Long Totals

SQL & Data · A per-row limit that applies to the whole group belongs in HAVING with MAX, not in WHERE; then the window-function follow-ups the interviewer moves to.

mediumSign in to star problems

How Do You Work With Stakeholders?

Behavioral · Collaboration style, a requirements disagreement, aligning competing priorities and leading without authority, each with a real example.

mediumSign in to star problems

A Time You Received Critical Feedback

Behavioral · Feedback that was genuinely uncomfortable, the first reaction, and a change in behaviour with evidence it lasted.

mediumSign in to star problems

More Work Than You Could Deliver

Behavioral · Explicit prioritisation criteria, the conversation with the people whose work slipped, and what you cut on purpose.

mediumSign in to star problems

A Team Culture Mismatch

Behavioral · Spotting that your way of working did not fit the team, adapting your own behaviour, and nudging the team where it helped.

mediumSign in to star problems

Handling Ambiguous Requirements

Behavioral · Turning a vague or shifting ask into a decision: the questions you asked, the assumptions you wrote down, and how you kept moving.

mediumSign in to star problems

Influencing Without Authority

Behavioral · A proposal that was not your assigned task, how you earned buy-in, and what changed as a result.

mediumSign in to star problems

Explain Docker to a Non-Technical Audience

Behavioral · The worked example of the hiring-manager round's communication question: a container explained to someone who will never run one, and how you check they got it.

mediumSign in to star problems

Why Disney, and Why This Role?

Behavioral · Motivation tied to the actual products and the confirmed responsibilities of the role, without invented facts.

mediumSign in to star problems

Getting Productive in an Unfamiliar Codebase

Behavioral · Joining a large codebase: what made it hard, the ramp-up steps you took, how soon you contributed, and what you left behind for the next person.

mediumSign in to star problems

Which Traits Would You Hire For?

Behavioral · The reverse behavioral: as the hiring manager of a new team, the traits you would screen for, the signals for each, and how you would assess adaptability.

mediumSign in to star problems

Your Infrastructure-as-Code Experience

Behavioral · A concrete infrastructure change you owned in Terraform or similar on AWS: review, state, access boundaries, and what went wrong.

mediumSign in to star problems

Prompting an LLM to Migrate a Codebase and Clean Data

Behavioral · Two verbal tech questions from a data-engineering loop: how you would instruct a model to port Java to Python and to clean an inconsistent table, with the safeguards around it.

mediumSign in to star problems

Decrypt to Dictionary Words

Algorithms & Data Structures · The Encrypt and Decrypt Strings variant the phone screen asks: return the dictionary words a ciphertext can decode to, not how many, by DFS with backtracking.

mediumSign in to star problems

Count Cells That Climb to the Global Maximum

Algorithms & Data Structures · A deterministic greedy walk uphill from every cell with a fixed tie-break; memoise where each walk ends, since strictly increasing heights cannot cycle.

mediumSign in to star problems

Transition Graph From Access Logs

Algorithms & Data Structures · Sort each user's accesses into a path from START to END, count transitions per source, and turn the counts into probabilities.

mediumSign in to star problems

Interleave Front and Back

Algorithms & Data Structures · First, last, second, second-to-last: two pointers walking inward build the new array in one pass.

easySign in to star problems

Shift Every Nth Consonant

Algorithms & Data Structures · Count consonants as you scan, advance every nth one to the next consonant with wrap-around, and keep its case.

easySign in to star problems

Longest Stable Transaction Period

Algorithms & Data Structures · The longest run of consecutive days whose total is divisible by k: prefix sums modulo k and the first index each remainder appeared.

mediumSign in to star problems

Animal Chess Engine

Algorithms & Data Structures · A 9 by 7 board with rivers, traps and dens, eight ranked pieces with the Rat-Elephant exception and the Lion and Tiger jump, driven through an action API; object-oriented design under test.

hardSign in to star problems

Does This In-Place Reverse Work?

Algorithms & Data Structures · A reversal loop that visits every index swaps each pair twice; fix the range and state the complexity.

easySign in to star problems

Top N Matches From a Constant-Time Score

Algorithms & Data Structures · P candidates, an O(1) score, N much smaller than P: a min-heap of size N beats sorting, in time and in space.

easySign in to star problems

Code Review: Glossary Entries by Time

Algorithms & Data Structures · A small Python diff to review on a shared screen: a hard-coded credential, a client built per call instead of the injected one, and a loop that loses its results.

mediumSign in to star problems

Seller Task Scheduler

Algorithms & Data Structures · Per-seller priority with FIFO ties, sellers taking turns in activation order, and VIP sellers taking up to two tasks per turn; the turn state has to survive between calls.

mediumSign in to star problems

Task Scheduler With Removal

Algorithms & Data Structures · addTask, removeTask and a destructive popTask(num) in timestamp order: a heap with lazy deletion, and a version per task so stale heap entries are recognised.

mediumSign in to star problems

LRU Cache With Expiry

Algorithms & Data Structures · The LRU follow-up: every entry carries a time-to-live, an expired entry is a miss, and expired entries must not take up capacity when something has to be evicted.

mediumSign in to star problems

Validated Add-Subtract Calculator

Algorithms & Data Structures · Evaluate digits joined by + and - only after proving the string is well formed: no stray characters, no leading zeros, no doubled operators, and everything inside 32 bits.

mediumSign in to star problems

Order Validator With Rule Dependencies

Algorithms & Data Structures · Validation rules form a DAG: a rule is skipped when a prerequisite did not pass, a dependency that would close a cycle is refused, and removing a rule reconnects its prerequisites to its dependents.

mediumSign in to star problems

Largest Number Below a Limit From Allowed Digits

Algorithms & Data Structures · Keep the limit's prefix as long as possible, step one digit down, then fill with the largest allowed digit; fall back to a shorter number, and mind leading zeros.

mediumSign in to star problems

Subarray With the Largest Min Plus Max

Algorithms & Data Structures · It looks like a sliding-window problem and is not one: the best subarray of length two or more is always an adjacent pair.

easySign in to star problems

Fish From Decaying Ponds

Algorithms & Data Structures · Each hour fished lowers a pond's next yield by one. The heap greedy is the first answer; the accepted one finds the water line all ponds are fished down to and sums arithmetic series.

mediumSign in to star problems

More Than a Third in a Sorted Array

Algorithms & Data Structures · In a sorted array a value that fills more than a third must cover the index at n/3 or at 2n/3, so two probes and four binary searches replace the scan.

mediumSign in to star problems

Earliest Block Removal That Balances the Array

Algorithms & Data Structures · Delete k consecutive elements so the even-indexed and odd-indexed sums of what remains are equal; an alternating prefix sum handles the parity flip of the shifted suffix.

mediumSign in to star problems

Docstring Naming Conversion

Algorithms & Data Structures · Inside backticks, snake_case identifiers become camelCase and UPPER_CASE constants stay; everything else, including every space, is copied through.

easySign in to star problems

Cyclic Number Pairs

Algorithms & Data Structures · Count pairs of numbers that are digit rotations of each other: give every number a canonical rotation and count equal keys instead of comparing pairs.

mediumSign in to star problems

Count Alternating-Parity Subarrays

Algorithms & Data Structures · Count the subarrays in which neighbours always differ in parity: the number ending at each index is the length of the current alternating streak.

easySign in to star problems

Aligned Memory Allocator

Algorithms & Data Structures · Simulate alloc and erase over a bit array where blocks must start on an 8-cell boundary; the care is in ids, bounds and erasing something twice.

mediumSign in to star problems

Reverse Words, Keeping the Spacing

Algorithms & Data Structures · Reverse the order of the words while every run of spaces stays exactly where it was, including leading and trailing runs.

easySign in to star problems

All Valid Expansions of Wildcard Parentheses

Algorithms & Data Structures · The follow-up to the wildcard validity check: enumerate every distinct balanced string the stars can produce, pruning on the running balance.

mediumSign in to star problems

House Segments After Demolitions

Algorithms & Data Structures · Houses on a number line form segments of consecutive positions; each demolition changes the segment count by +1, 0 or -1 depending only on the two neighbours.

mediumSign in to star problems

Sort Each Border of a Matrix

Algorithms & Data Structures · For every concentric ring, collect the values clockwise from the ring's top-left corner, sort them, and write them back in the same order; single-row and single-column centres are the trap.

mediumSign in to star problems

Is the Tic-Tac-Toe Game Over?

Algorithms & Data Structures · Given an n by n board, decide whether a player has completed a row, column or diagonal, or the board is full; then make it constant time per move.

easySign in to star problems

Longest Zigzag Path in a Grid

Algorithms & Data Structures · A path whose value comparisons strictly alternate up and down. Unlike the longest increasing path, it can turn back on itself, so it needs backtracking with a visited set rather than memoisation.

mediumSign in to star problems

Cheapest Grid Path With a Fuel Tank

Algorithms & Data Structures · Each cell has an entry cost, each step burns a unit of fuel, and marked cells refill the tank: Dijkstra over (row, column, fuel left), then the follow-up for a very large tank.

hardSign in to star problems

Count Path Sums in an N-ary Tree

Algorithms & Data Structures · Count downward paths that add up to a target when a node can have any number of children: a prefix-sum counter that is scoped to the current root-to-node path.

mediumSign in to star problems

Equalize Root-to-Leaf Sums in an N-ary Tree

Algorithms & Data Structures · Raise node values by one at a time until every root-to-leaf path has the same sum, using the fewest increments: lift each shortfall as high in the tree as it can go.

mediumSign in to star problems

Binary Tree Maximum Path Sum, With the Path

Algorithms & Data Structures · The maximum path sum is the warm-up; the follow-up wants the nodes on the path, which means recording which arm each node extends and stitching two arms together at the best bend.

hardSign in to star problems

Serialize a Key-Value Store

Algorithms & Data Structures · Turn a map of arbitrary strings into one string and back. Any separator can appear in the data, so the format has to say where each field ends: length prefixes.

mediumSign in to star problems

Build a Comment Tree From Flat Records

Frontend · Turn a flat list of comments with parent ids into nested roots with children, in two passes with a map, without depending on input order or mutating the input.

easySign in to star problems

Heaviest Set of Non-Adjacent Nodes

Algorithms & Data Structures · House Robber on an arbitrary small graph: with at most 20 nodes, a dynamic programme over subsets decides, for the lowest remaining node, take it and drop its neighbours or skip it.

mediumSign in to star problems

Count Islands on a Torus

Algorithms & Data Structures · Number of Islands where the top edge touches the bottom and the left edge touches the right: wrap the neighbour arithmetic, then discuss union-find and cell flips.

mediumSign in to star problems

Reverse the Order of K-Groups

Algorithms & Data Structures · Not the usual reversal inside each group: the groups of k nodes change places while each keeps its internal order, done by prepending each group to the result.

mediumSign in to star problems

Design a Content Moderation System

System Design · Uploads flow through cheap filters, per-modality models and a human review queue; decisions are auditable, and past content can be replayed when the rules change.

hardSign in to star problems

Design a Payment System With Holds and Settlement

System Design · A payment-intent state machine, a real-time hold followed by batch settlement, idempotency keys so retries never charge twice, and a ledger that reconciles after bank timeouts.

hardSign in to star problems

Design Ticket Booking for a High-Demand On-Sale

System Design · Two separate problems: absorbing the burst at the moment sales open, and never selling the same seat twice, with holds that expire when payment does not arrive.

hardSign in to star problems

Design Top Songs by Country

System Design · Fifty thousand listen events a second become a top-ten list per country that refreshes every ten minutes and is read from a small cached object.

mediumSign in to star problems

Design Recent Like Counts and Trending Posts

System Design · Three reads over a 60-second window at a million likes a second: an exact count for one post from per-second buckets, and global and per-region top lists from a stream job.

hardSign in to star problems

Design a Real-Time Auction

System Design · Bids arrive over REST, are ordered per auction through a partitioned log, update a durable state machine, and are pushed to watchers over server-sent events.

hardSign in to star problems

Design a Synchronized Live Comment Overlay

System Design · Comments that fly across a video in step with playback: timeline-indexed storage for recorded video, fan-out over push connections for live, and sampling when a room is too busy to show everything.

mediumSign in to star problems

Design a Video-Keyword Association Review System

System Design · Batches of 50 videos against 1,000 keywords, edited over time: versioned submissions, resumable uploads, and recomputing only the pairs that a change touches.

mediumSign in to star problems

Design an AI-Driven QA Pipeline

System Design · From a requirements document to test cases, data, scripts, execution and a report, with role-specific agents that hand artifacts to one another, human checkpoints, and a CI environment that has no GPU.

mediumSign in to star problems

Design Overload Protection With Load Shedding

System Design · Keep a service doing useful work when demand exceeds capacity: detect overload from queue time, reject early by priority, bound every queue, and stop retries from making it worse.

mediumSign in to star problems

Design a RAG-Based Agent System

System Design · An agent that retrieves, calls tools and answers: the ingestion and retrieval path, the tool loop with state and limits, tracing for failed tool calls, and how its quality is measured.

mediumSign in to star problems

Prevent a Cache Stampede on a Hot Key

System Design · When a very popular cache entry expires, thousands of requests miss at once and all hit the database: let one caller rebuild, serve the old value meanwhile, and refresh before expiry.

mediumSign in to star problems

TCP vs UDP

System Design · TCP gives an ordered, reliable byte stream at the cost of setup and head-of-line blocking; UDP sends independent datagrams and leaves the rest to the application.

easySign in to star problems

The TCP Three-Way Handshake

System Design · SYN, SYN-ACK, ACK: each side proves it can send and receive and the two exchange starting sequence numbers; closing takes four segments.

easySign in to star problems

HTTP/1.1, HTTP/2, HTTP/3 and gRPC

System Design · HTTP/2 multiplexes streams on one TCP connection, HTTP/3 moves to QUIC over UDP to remove transport head-of-line blocking, and gRPC is typed RPC over HTTP/2.

easySign in to star problems

A Request's Path Into a Kubernetes Cluster

System Design · DNS, load balancer, ingress, Service virtual IP, pod: with what a node and a pod are, ClusterIP versus NodePort, DNS caching, and where to look when the answer is a 5xx.

easySign in to star problems

Kafka Delivery Semantics

System Design · Partitions give order, consumer groups give scale, and committing offsets before or after processing decides between at-most-once and at-least-once; exactly-once needs idempotence or transactions.

easySign in to star problems

The TLS Handshake and HTTPS Inspection

System Design · The handshake authenticates the server by certificate and derives session keys by key exchange; inspecting HTTPS means terminating TLS at something the client has been told to trust.

easySign in to star problems

Virtual Memory

System Design · Each process gets its own address space mapped page by page onto physical memory or disk, which is how programs can use more memory than the machine has.

easySign in to star problems

REST, WebSocket or Server-Sent Events?

System Design · Request and response, a two-way persistent socket, or a one-way server stream over HTTP: pick by who needs to talk and how often, as for an agent that streams its answer.

easySign in to star problems

The CAP Theorem

System Design · During a network partition a distributed store must choose between answering with possibly stale data and refusing to answer; it is a statement about partitions, not a permanent pick of two from three.

easySign in to star problems

Redis Persistence and Scaling

System Design · Snapshots and an append-only file for durability, replicas with Sentinel for failover, and Cluster's hash slots for sharding, around a single-threaded command loop.

easySign in to star problems

Composite and Covering Indexes

SQL & Data · A composite index is sorted by its columns in order, so only a leftmost prefix can be searched; when it also contains every column the query needs, the table is never read.

easySign in to star problems

Evaluating a Move From MySQL to MongoDB

SQL & Data · A migration is justified by the workload, access patterns, schema shape and scale, and by a measured result, not by a list of SQL-versus-NoSQL traits.

easySign in to star problems

The Disk Is Full: Triage

System Design · From the filesystem that is full, to the directory, to the file, to the process, including the case where the space is held by a deleted file that is still open.

easySign in to star problems

The Backend Is Slow: Triage

System Design · Scope the problem with metrics, find the slow hop with traces, then test one hypothesis per layer: saturation, a dependency, the database, or a recent change.

easySign in to star problems

Nested Comment Thread

Frontend · A reusable comment component: replies nested to any depth, an inline reply form, a hide/show toggle with a count, and a flat list in state with the tree derived from it.

mediumSign in to star problems

Walk Me Through a Project on Your Resume

Behavioral · Fifteen to thirty minutes of drilling on one project: the decisions, the alternatives you rejected, the numbers, and what you would do differently.

mediumSign in to star problems

What Is Your Biggest Weakness?

Behavioral · A real weakness with a real cost, what you changed, and evidence that the change held; not a strength in disguise.

mediumSign in to star problems

Why This Team, and Why Are You Leaving?

Behavioral · Motivation that is specific to the team's product and problems, a reason for moving that is not a complaint, and a direction for the next few years.

mediumSign in to star problems

Can You Work in a High-Intensity Environment?

Behavioral · A direct culture question: evidence that you have delivered under sustained pressure, how you prioritise and protect quality, and the boundaries you keep.

mediumSign in to star problems

Tell Me About a Time You Failed

Behavioral · A failure that was yours, told without excuses: the decision, the impact, the recovery, and the change in how you work.

mediumSign in to star problems

Why Did This Project Matter?

Behavioral · The director's version of the deep dive: twenty minutes on outcome and scope, where the answer starts with users and the business and reaches the technology only if asked.

mediumSign in to star problems

Asked on LeetCode

3,115 questions · all time

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.