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.

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

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

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

Maximize Boxes Stored Through One Entrance

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

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

Settle Debts I

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

mediumSign 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

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

Stateful Search Autocomplete Session

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

hardSign 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reconstruct Itinerary II

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

hardSign 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

Brace Expansion II

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

hardSign 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Asked on LeetCode

1,123 questions tagged Stack or Hash Table or Sorting · 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.