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.
- Tree242
- Array1842
- String778
- Hash Table749
- Math565
- Dynamic Programming534
- Sorting483
- Greedy401
- Depth-First Search338
- Binary Search305
- Matrix267
- Breadth-First Search261
Mark and Compact a Heap-Indexed Subtree
Algorithms & Data Structures · Garbage collection in miniature: mark a subtree, compact, remap.
Algorithms & Data Structures · One DFS from the base unit multiplies factors down the tree, modulo a prime.
Algorithms & Data Structures · Build in-order and pull values off a forward-only iterator — no middle-finding, no array copy.
Algorithms & Data Structures · Convert through the base unit — and divide with a modular inverse, since you can't divide mod p.
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.
Algorithms & Data Structures · A deleted node hands its children to its nearest surviving ancestor, so it simply adds no level.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Asked on LeetCode
224 questions tagged Tree · all time
- Binary Tree Maximum Path SumhardDynamic ProgrammingTreeDepth-First SearchBinary Tree+117 companies
- Lowest Common Ancestor of a Binary TreemediumTreeDepth-First SearchBinary TreeBinary Lifting+114 companies
- Serialize and Deserialize Binary TreehardStringTreeDepth-First SearchBreadth-First Search+214 companies
- Flatten Nested List IteratormediumStackTreeDepth-First SearchDesign+213 companies
- Validate Binary Search TreemediumTreeDepth-First SearchBinary Search TreeBinary Tree13 companies
- Binary Tree Zigzag Level Order TraversalmediumTreeBreadth-First SearchBinary Tree13 companies
- All Nodes Distance K in Binary TreemediumHash TableTreeDepth-First SearchBreadth-First Search+112 companies
- Diameter of Binary TreeeasyTreeDepth-First SearchBinary TreeDP on Trees12 companies
- Maximum Depth of Binary TreeeasyTreeDepth-First SearchBreadth-First SearchBinary Tree11 companies
- Lowest Common Ancestor of a Binary Tree IIImediumHash TableTwo PointersTreeBinary Tree+210 companies
- Binary Tree Right Side ViewmediumTreeDepth-First SearchBreadth-First SearchBinary Tree10 companies
- Vertical Order Traversal of a Binary TreehardHash TableTreeDepth-First SearchBreadth-First Search+210 companies
- House Robber IIImediumDynamic ProgrammingTreeDepth-First SearchBinary Tree+110 companies
- Binary Tree Level Order TraversalmediumTreeBreadth-First SearchBinary Tree10 companies
- Binary Tree CamerashardDynamic ProgrammingTreeDepth-First SearchBinary Tree+19 companies
- Binary Tree Vertical Order TraversalmediumHash TableTreeDepth-First SearchBreadth-First Search+29 companies
- Kth Largest Element in a StreameasyTreeDesignBinary Search TreeHeap (Priority Queue)+29 companies
- Kth Smallest Element in a BSTmediumTreeDepth-First SearchBinary Search TreeBinary Tree9 companies
- Path Sum IIImediumTreeDepth-First SearchBinary Tree9 companies
- Symmetric TreeeasyTreeDepth-First SearchBreadth-First SearchBinary Tree9 companies
- Construct Binary Tree from Preorder and Inorder TraversalmediumArrayHash TableDivide and ConquerTree+19 companies
- Delete Node in a BSTmediumTreeBinary Search TreeBinary Tree9 companies
- Amount of Time for Binary Tree to Be InfectedmediumHash TableTreeDepth-First SearchBreadth-First Search+19 companies
- Path SumeasyTreeDepth-First SearchBreadth-First SearchBinary Tree9 companies
- Lowest Common Ancestor of a Binary Search TreemediumTreeDepth-First SearchBinary Search TreeBinary Tree+28 companies
- Convert Sorted Array to Binary Search TreeeasyArrayDivide and ConquerTreeBinary Search Tree+18 companies
- Boundary of Binary TreemediumTreeDepth-First SearchBinary Tree8 companies
- Maximum Width of Binary TreemediumTreeDepth-First SearchBreadth-First SearchBinary Tree8 companies
- Same TreeeasyTreeDepth-First SearchBreadth-First SearchBinary Tree8 companies
- Create Binary Tree From DescriptionsmediumArrayHash TableTreeBinary Tree8 companies
- Construct Binary Tree from Preorder and Postorder TraversalmediumArrayHash TableDivide and ConquerTree+18 companies
- Subtree of Another TreeeasyTreeDepth-First SearchString MatchingBinary Tree+17 companies
- Construct Quad TreemediumArrayDivide and ConquerTreeMatrix7 companies
- Unique Binary Search TreesmediumMathDynamic ProgrammingTreeBinary Search Tree+17 companies
- Merge Two Binary TreeseasyTreeDepth-First SearchBreadth-First SearchBinary Tree7 companies
- Binary Search Tree IteratormediumStackTreeDesignBinary Search Tree+27 companies
- Insert into a Binary Search TreemediumTreeBinary Search TreeBinary Tree7 companies
- Balanced Binary TreeeasyTreeDepth-First SearchBinary Tree7 companies
- Binary Tree Inorder TraversaleasyStackTreeDepth-First SearchBinary Tree7 companies
- Populating Next Right Pointers in Each Node IImediumLinked ListTreeDepth-First SearchBreadth-First Search+17 companies
- Find Largest Value in Each Tree RowmediumTreeDepth-First SearchBreadth-First SearchBinary Tree7 companies
- Invert Binary TreeeasyTreeDepth-First SearchBreadth-First SearchBinary Tree7 companies
- Recover Binary Search TreemediumTreeDepth-First SearchBinary Search TreeBinary Tree7 companies
- Serialize and Deserialize N-ary TreehardStringTreeDepth-First SearchBreadth-First Search7 companies
- Tree DiametermediumTreeDepth-First SearchBreadth-First SearchGraph Theory+27 companies
- Construct Binary Tree from Inorder and Postorder TraversalmediumArrayHash TableDivide and ConquerTree+17 companies
- Two Sum IV - Input is a BSTeasyHash TableTwo PointersTreeDepth-First Search+37 companies
- Path Sum IImediumBacktrackingTreeDepth-First SearchBinary Tree7 companies
- Find Duplicate SubtreesmediumHash TableTreeDepth-First SearchBinary Tree7 companies
- Convert Sorted List to Binary Search TreemediumLinked ListDivide and ConquerTreeBinary Search Tree+17 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.