Binary Tree
51 problems · 49 with full explanations
14 Easy32 Medium2 Hard
Binary trees have at most two children per node. Master the three DFS orders (pre/in/post) and level-order BFS. Key problems: height, diameter, path sum, lowest common ancestor, and serialization. Recursive solutions are clean but watch recursion depth for very deep trees.
How to practice
To practice Binary Tree problems effectively, start with the Easy problems listed below, trace through each solution on paper, then re-implement without looking. When you can recognise the binary tree pattern within 30 seconds of reading a new problem, move on to Medium difficulty. Use the related topic pages and our study guide for a structured progression.
Start here (Easy + explained)
All Binary Tree problems
- 95.Unique Binary Search Trees IIMedium
- 100.Same TreeEasy
- 102.Binary Tree Level Order TraversalMedium
- 106.Construct Binary Tree from Inorder and Postorder TraversalMedium
- 107.Binary Tree Level Order Traversal IIMedium
- 108.Convert Sorted Array to Binary Search TreeEasy
- 110.Balanced Binary TreeEasy
- 111.Minimum Depth of Binary TreeEasy
- 112.Path SumEasy
- 113.Path Sum IIMedium
- 114.Flatten Binary Tree to Linked ListMedium
- 144.Binary Tree Preorder TraversalEasy
- 145.Binary Tree Postorder TraversalEasy
- 222.Count Complete Tree NodesMedium
- 230.Kth Smallest Element in a BSTMedium
- 236.Lowest Common Ancestor of a Binary TreeMedium
- 257.Binary Tree PathsEasy
- 331.Verify Preorder Serialization of a Binary TreeUnknown
- 508.Most Frequent Subtree SumMedium
- 513.Find Bottom Left Tree ValueMedium
- 515.Find Largest Value in Each Tree RowMedium
- 623.Add One Row to TreeMedium
- 700.Search in a Binary Search TreeEasy
- 703.Kth Largest Element in a StreamEasy
- 865.Smallest Subtree with all the Deepest NodesMedium
- 889.Construct Binary Tree from Preorder and Postorder TraversalMedium
- 951.Flip Equivalent Binary TreesMedium
- 965.Univalued Binary TreeEasy
- 998.Maximum Binary Tree IIMedium
- 1022.Sum of Root To Leaf Binary NumbersEasy
- 1028.Recover a Tree From Preorder TraversalHard
- 1038.Binary Search Tree to Greater Sum TreeMedium
- 1080.Insufficient Nodes in Root to Leaf PathsMedium
- 1110.Delete Nodes And Return ForestMedium
- 1123.Lowest Common Ancestor of Deepest LeavesMedium
- 1161.Maximum Level Sum of a Binary TreeMedium
- 1261.Find Elements in a Contaminated Binary TreeMedium
- 1305.All Elements in Two Binary Search TreesUnknown
- 1339.Maximum Product of Splitted Binary TreeMedium
- 1367.Linked List in Binary TreeMedium
- 1382.Balance a Binary Search TreeMedium
- 1530.Number of Good Leaf Nodes PairsMedium
- 2096.Step-By-Step Directions From a Binary Tree Node to AnotherMedium
- 2196.Create Binary Tree From DescriptionsMedium
- 2236.Root Equals Sum of ChildrenEasy
- 2331.Evaluate Boolean Binary TreeEasy
- 2415.Reverse Odd Levels of Binary TreeMedium
- 2458.Height of Binary Tree After Subtree Removal QueriesUnknown
- 2471.Minimum Number of Operations to Sort a Binary Tree by LevelHard
- 2583.Kth Largest Sum in a Binary TreeMedium
- 2641.Cousins in Binary Tree IIMedium