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.

Mark and Compact a Heap-Indexed Subtree

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

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

Exact Board Jumps I

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

easySign 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

Course Schedule

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

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

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

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

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

Reconstruct Itinerary II

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

hardSign 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

Sensor Network II

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

easySign 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Asked on LeetCode

801 questions tagged Memoization or Depth-First Search or Dynamic Programming · 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.