Back to Patterns
7
Trees
A Tree is a hierarchical data structure consisting of nodes. Binary Trees (and Binary Search Trees) are incredibly common in technical interviews. Solutions usually heavily rely on recursion and Depth-First Search (DFS) or Breadth-First Search (BFS).
Problems (15)
Invert Binary Tree
Easy
Maximum Depth of Binary Tree
Easy
Diameter of Binary Tree
Easy
Balanced Binary Tree
Easy
Same Tree
Easy
Subtree of Another Tree
Easy
Lowest Common Ancestor of a Binary Search Tree
Medium
Binary Tree Level Order Traversal
Medium
Binary Tree Zigzag Level Order Traversal
Medium
Binary Tree Right Side View
Medium
Validate Binary Search Tree
Medium
Kth Smallest Element in a BST
Medium
Construct Binary Tree from Preorder and Inorder Traversal
Medium
Binary Tree Maximum Path Sum
Hard
Serialize and Deserialize Binary Tree
Hard