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.

Nested Set Equality

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

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

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

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

Settle Debts I

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

mediumSign 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

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

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

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

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

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

Merge Overlapping Intervals

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Asked on LeetCode

660 questions tagged Sorting or Tree · 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.