Trees
29 animated solutionsRecursion on rooted structures: depth-first traversals, level-order BFS with a queue, and divide-and-conquer over subtrees. Most tree problems ask you to trust the recursion. Every problem below plays as an animated walkthrough with solutions in Python, Java and C++. Companies that ask these most: Wix, Meta, Yahoo.
Average of Levels in Binary Tree
Balanced Binary Tree
Convert Sorted Array to Binary Search Tree
Diameter of Binary Tree
Invert Binary Tree
Maximum Depth of Binary Tree
Minimum Absolute Difference in BST
Path Sum
Same Tree
Subtree of Another Tree
Symmetric Tree
Binary Search Tree Iterator
Binary Tree Level Order Traversal
Binary Tree Right Side View
Binary Tree Zigzag Level Order Traversal
Construct Binary Tree From Preorder And Inorder Traversal
Construct Binary Tree from Inorder and Postorder Traversal
Construct Quad Tree
Count Complete Tree Nodes
Count Good Nodes In Binary Tree
Flatten Binary Tree to Linked List
Kth Smallest Element In a Bst
Lowest Common Ancestor of a Binary Search Tree
Lowest Common Ancestor of a Binary Tree
Populating Next Right Pointers in Each Node II
Sum Root to Leaf Numbers
Validate Binary Search Tree
Binary Tree Maximum Path Sum
Serialize And Deserialize Binary Tree