DDSA Solutions

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.

Open the full study guide →

Start here (Easy + explained)

All Binary Tree problems