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.
- Math565
- Design180
- Array1842
- String778
- Hash Table749
- Dynamic Programming534
- Sorting483
- Greedy401
- Depth-First Search338
- Binary Search305
- Matrix267
- Breadth-First Search261
Algorithms & Data Structures · Arbitrary-precision rounding — floats need not apply.
Algorithms & Data Structures · Streaming design: recent counts, top-k, and sliding-window bans.
Algorithms & Data Structures · Reassemble lines from arbitrary chunks, reading lazily.
Algorithms & Data Structures · Advance players in O(1), rank them without sorting — a linked list per room.
Algorithms & Data Structures · Smallest-free allocation under a capacity that moves at runtime.
Sparse Matrix Storage, Addition, and Multiplication
Algorithms & Data Structures · Storage proportional to nonzeros — and the cancellation trap.
Implement Single-Tab Browser History Navigation
Algorithms & Data Structures · A cursor over one visit stack: truncate forward history, clamp at both ends.
Algorithms & Data Structures · Pack named ID ranges, then resize with all-or-nothing shifts.
Algorithms & Data Structures · Two sorted indexes and a binary search you write by hand.
Stateful Search Autocomplete Session
Algorithms & Data Structures · A typing session over search counts: top three by frequency, then alphabetically.
Algorithms & Data Structures · An undo log per open transaction: rollback replays it, commit hands it to the parent.
Algorithms & Data Structures · Injected transport, upserts keyed by id, a dirty set — a small class with senior signals.
Algorithms & Data Structures · A tree of nodes keyed by path segment — the OOD-style prompt where the implementation is the test.
Algorithms & Data Structures · Pluggable backoff, a retryable filter, hooks, and an abort signal around one loop.
Algorithms & Data Structures · Consume the oldest stock first and say which lots an order drew from — an implementation prompt with tie-break rules.
Memory-Bounded Ranked Ballot Counter
Algorithms & Data Structures · Millions of ballots, Borda scoring, and memory that stays O(candidates) — the constraint is the question.
Algorithms & Data Structures · Separate chaining with a resize at a load-factor threshold — fixed buckets aren't enough.
Algorithms & Data Structures · A heap cannot update a key — push the new entry and discard stale ones at pop time.
Algorithms & Data Structures · One DFS from the base unit multiplies factors down the tree, modulo a prime.
Nth Node at Level L in a 0/1 Tree
Algorithms & Data Structures · Never build the tree — halve recursively, or read the answer off the parity of popcount(n − 1).
Algorithms & Data Structures · A queue of admitted timestamps per key: evict what aged out, admit while under the limit.
Algorithms & Data Structures · Flatten behind hasNext/next with O(depth) memory — and survive [[], [[]], [[], [3]]].
Algorithms & Data Structures · One pass and O(k) memory: item i replaces a random slot with probability k/(i+1).
Algorithms & Data Structures · Two heaps — a max-heap for the lower half, a min-heap for the upper — rebalanced on every add.
Algorithms & Data Structures · Three guarded divisions — and 0 wherever a denominator is 0.
Algorithms & Data Structures · Map, combine, partition, sort, reduce — the three parts a groupby does not have are the whole grade.
Algorithms & Data Structures · Half-open intervals per room, only neighbours can clash — and check-then-book must be one atomic step.
Algorithms & Data Structures · Idempotent writes, a separate read model, and an audit log — all three in one small service.
Algorithms & Data Structures · One pass with a stack of signed terms; the trap is integer division truncating toward zero.
Algorithms & Data Structures · TCP is a byte stream: buffer across calls, frame by length prefix, and tell a clean EOF from a truncated message.
Implement a Robust REST Create Method
Algorithms & Data Structures · Authenticate, validate, sanitise — then make POST safe to retry with an Idempotency-Key scoped to the caller.
Algorithms & Data Structures · Hash map plus doubly linked list, all operations O(1).
Algorithms & Data Structures · PUT, GET and a COUNT of everything under a domain: match on the label boundary, then make COUNT fast with a trie.
Algorithms & Data Structures · A second stack holds the minimum at each depth, so getMin is just its top.
Parse an Integer Without parseInt
Algorithms & Data Structures · Sign, then digits through a lookup table, accumulating n * 10 + d — and NaN for anything else.
Algorithms & Data Structures · Split, round each value with string arithmetic, join — floats need not apply.
Algorithms & Data Structures · One formula for every dimension: the square root of the summed squared differences.
Algorithms & Data Structures · Buckets plus underflow and overflow: O(1) adds, any quantile, error within half a bucket.
Algorithms & Data Structures · Convert through the base unit — and divide with a modular inverse, since you can't divide mod p.
Algorithms & Data Structures · Store (tokens, last seen) per key and refill lazily on each call — O(1) per key.
Algorithms & Data Structures · Chain iterables behind hasNext/next with a lookahead that skips the empty ones.
Stratified Sampling with Largest-Remainder Allocation
Algorithms & Data Structures · Floor each proportional share, give leftovers to the largest remainders, sample within each stratum.
Algorithms & Data Structures · Discount each graded relevance by log2(position + 2), then divide by the ideal ordering's DCG.
Algorithms & Data Structures · Observed agreement corrected for the agreement two annotators would reach by chance.
Algorithms & Data Structures · 1 − C(n − c, k) / C(n, k), computed as a running product so nothing overflows.
Algorithms & Data Structures · Buffer bytes across recv calls, split on newlines, and decode only whole lines.
Algorithms & Data Structures · Binary long multiplication: add the doubled multiple for every set bit — and double with +=, not a 32-bit shift.
Algorithms & Data Structures · Each position multiplies its two successors, wrapping around the end with modular indices.
Algorithms & Data Structures · A base case at n <= 0 and one recursive call — then say where the call stack runs out.
Algorithms & Data Structures · Binary-search the root in [0, max(1, x)] for a fixed number of rounds — an epsilon loop never ends for large x.
Algorithms & Data Structures · An infinite generator over two BigInts — ordinary numbers lose precision past the 78th term.
Algorithms & Data Structures · Per-client (tokens, last seen), a tier config read on every call, and an explicit fallback for clients with no valid tier.
Algorithms & Data Structures · Timestamps arrive in order, so each type's list is already sorted and a count is two binary searches.
Algorithms & Data Structures · A heap of entries with lazy deletion: a task added twice has two entries, and the stale one is skipped on the way out.
Key-Value Store With Prefix Scan
Algorithms & Data Structures · A hash map for the point operations and a sorted key list for the scan — agree the smallest version, then extend.
Document Store With Boolean Queries
Algorithms & Data Structures · An inverted index plus a tiny expression parser whose values are sets of document ids.
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.
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.
Pick the Query Type That Maximises Revenue
Algorithms & Data Structures · Committing to one type, you run it floor(k / duration) times; score every type and keep the best, earliest on ties.
Reach a Target With +2, Double and Halve
Algorithms & Data Structures · Any sequence counts, so think constructively: +2 keeps parity, doubling then +2s then halving shifts it, and halving is how you get smaller.
Count the Nodes of a Tree by Messages
Algorithms & Data Structures · A node asks every neighbour except the one that asked it, sums the replies plus one, and remembers answers so duplicates are harmless.
Algorithms & Data Structures · Pre-order with explicit end-of-word marks and parentheses around children; parsing it back is a recursive descent.
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.
Algorithms & Data Structures · One person, every cake: scan the grid once keeping the cake with the smallest Manhattan distance.
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.
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].
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Asked on LeetCode
653 questions tagged Design or Math · all time
- LRU CachemediumHash TableLinked ListDesignDoubly-Linked List47 companies
- Find Median from Data StreamhardTwo PointersDesignSortingHeap (Priority Queue)+126 companies
- Time Based Key-Value StoremediumHash TableStringBinary SearchDesign26 companies
- Insert Delete GetRandom O(1)mediumArrayHash TableMathDesign+124 companies
- Basic Calculator IImediumMathStringStack19 companies
- LFU CachehardHash TableLinked ListDesignDoubly-Linked List19 companies
- Add Two NumbersmediumLinked ListMathRecursion18 companies
- Design Circular QueuemediumArrayLinked ListDesignQueue18 companies
- Design Hit CountermediumArrayBinary SearchDesignQueue+118 companies
- Basic CalculatorhardMathStringStackRecursion17 companies
- Implement Trie (Prefix Tree)mediumHash TableStringDesignTrie17 companies
- Rotate ImagemediumArrayMathMatrix17 companies
- Min StackmediumStackDesign17 companies
- Random Pick with WeightmediumArrayMathBinary SearchPrefix Sum+116 companies
- Climbing StairseasyMathDynamic ProgrammingMemoization16 companies
- Design Memory AllocatormediumArrayHash TableDesignSimulation15 companies
- Integer to RomanmediumHash TableMathString15 companies
- Roman to IntegereasyHash TableMathString14 companies
- Snapshot ArraymediumArrayHash TableBinary SearchDesign+114 companies
- Sqrt(x)easyMathBinary SearchNewton's Method14 companies
- Serialize and Deserialize Binary TreehardStringTreeDepth-First SearchBreadth-First Search+214 companies
- Flatten Nested List IteratormediumStackTreeDepth-First SearchDesign+213 companies
- Integer to English WordshardMathStringRecursion13 companies
- Simple Bank SystemmediumArrayHash TableDesignSimulation13 companies
- Design Tic-Tac-ToemediumArrayHash TableDesignMatrix+113 companies
- Logger Rate LimitereasyHash TableDesignData Stream13 companies
- Pow(x, n)mediumMathRecursion13 companies
- Unique PathsmediumMathDynamic ProgrammingCombinatorics13 companies
- Design Browser HistorymediumArrayLinked ListStackDesign+212 companies
- Evaluate Reverse Polish NotationmediumArrayMathStack12 companies
- Happy NumbereasyHash TableMathTwo PointersFloyd's Cycle Finding Algorithm12 companies
- K Closest Points to OriginmediumArrayMathDivide and ConquerGeometry+412 companies
- Max Points on a LinehardArrayHash TableMathGeometry+212 companies
- All O`one Data StructurehardHash TableLinked ListDesignDoubly-Linked List12 companies
- Design Add and Search Words Data StructuremediumStringDepth-First SearchDesignTrie12 companies
- Design Search Autocomplete SystemhardStringDepth-First SearchDesignTrie+312 companies
- Multiply StringsmediumMathStringSimulation11 companies
- Dot Product of Two Sparse VectorsmediumArrayHash TableTwo PointersDesign+111 companies
- Design In-Memory File SystemhardHash TableStringDesignTrie+110 companies
- My Calendar ImediumArrayBinary SearchDesignSegment Tree+110 companies
- Insert Delete GetRandom O(1) - Duplicates allowedhardArrayHash TableMathDesign+110 companies
- Fizz BuzzeasyMathStringSimulation10 companies
- Count PrimesmediumArrayMathEnumerationNumber Theory+310 companies
- Missing NumbereasyArrayHash TableMathBinary Search+210 companies
- Moving Average from Data StreameasyArrayDesignQueueData Stream9 companies
- Design TwittermediumHash TableLinked ListDesignHeap (Priority Queue)9 companies
- Best Meeting PointhardArrayMathSortingMatrix9 companies
- Kth Largest Element in a StreameasyTreeDesignBinary Search TreeHeap (Priority Queue)+29 companies
- Power of TwoeasyMathBit ManipulationRecursion9 companies
- Reverse IntegermediumMath9 companies
Listings only — titles, difficulty, and tags link out to LeetCode. Imported from the leetcode-company-wise-problems snapshot dated 1 June 2025. Frequency is that dataset's own relative score within a company and time range.