33 problems
Tree interview problems
33 Tree problems, from easy to hard. Each one has an editorial explaining the approach and its complexity, and a visualizer that runs the solution step by step on the example input or your own.
Easy (13)
- 87. Binary Tree Inorder TraversalEasy
- 90. Same TreeEasy
- 91. Symmetric TreeEasy
- 94. Maximum Depth of Binary TreeEasy
- 99. Balanced Binary TreeEasy
- 100. Path SumEasy
- 132. Binary Tree Preorder TraversalEasy
- 133. Binary Tree Postorder TraversalEasy
- 177. Count Complete Tree NodesEasy
- 180. Invert Binary TreeEasy
- 268. Diameter of Binary TreeEasy
- 272. Subtree of Another TreeEasy
- 275. Average of Levels in Binary TreeEasy
Medium (17)
- 89. Validate Binary Search TreeMedium
- 92. Binary Tree Level Order TraversalMedium
- 93. Binary Tree Zigzag Level Order TraversalMedium
- 95. Construct Binary Tree from Preorder and Inorder TraversalMedium
- 96. Construct Binary Tree from Inorder and Postorder TraversalMedium
- 102. Flatten Binary Tree to Linked ListMedium
- 104. Populating Next Right Pointers in Each NodeMedium
- 105. Populating Next Right Pointers in Each Node IIMedium
- 117. Sum Root to Leaf NumbersMedium
- 157. Binary Tree Right Side ViewMedium
- 184. Kth Smallest Element in a BSTMedium
- 188. Lowest Common Ancestor of a Binary TreeMedium
- 222. House Robber IIIMedium
- 250. Path Sum IIIMedium
- 308. All Nodes Distance K in Binary TreeMedium
- 341. Count Good Nodes in Binary TreeMedium
- 372. Count Nodes Equal to Average of SubtreeMedium