Tree Practice Questions
Ten classic tree problems. Each one is a small variation on the three-question recipe from Day 5 — Thinking Recursively: base case for null, recursive call on each child, combine.
Notice how short the solutions are — most are 3–8 lines. That’s the magic of recursion on trees: you describe one level, and the call stack handles the entire structure.
Easy
| Problem | Pattern | Status |
|---|---|---|
| Same Tree | Pair-wise recursion | Available |
| Symmetric Tree | Mirror recursion | Available |
| Maximum Depth of Binary Tree | Postorder | Available |
| Invert Binary Tree | Recursion + swap | Available |
| Path Sum | Top-down recursion | Available |
| Balanced Binary Tree | Postorder + height (fused traversal) | Available |
| Diameter of Binary Tree | Postorder + accumulator | Available |
Medium
| Problem | Pattern | Status |
|---|---|---|
| Binary Tree Level Order Traversal | BFS with the snapshot trick | Available |
| Validate Binary Search Tree | Inorder / bounds | Available |
| Convert Sorted Array to BST | Divide & conquer | Available |
More Practice (Coming Soon)
| Problem | Pattern | Status |
|---|---|---|
| Lowest Common Ancestor of a BST | Tree walk with comparisons | Coming Soon |
| Lowest Common Ancestor of Binary Tree | Postorder + flag bubbling | Coming Soon |
| Construct Binary Tree from Preorder + Inorder | Divide-and-conquer + index map | Coming Soon |
| Binary Tree Right Side View | BFS, last of each level | Coming Soon |
| Binary Tree Maximum Path Sum | Postorder + accumulator | Coming Soon |
| Kth Smallest Element in a BST | Inorder, stop at K | Coming Soon |
| Binary Tree Zigzag Level Order | BFS + alternating reverse | Coming Soon |
| Serialize and Deserialize Binary Tree | Preorder with null markers | Coming Soon |
| Recover BST (two swapped nodes) | Inorder + tracking violations | Coming Soon |