Trees - Patterns | Topics | Sample Problems

The goal of this post is to be your one stop destination for Trees preparation. We achieve this by solving most important questions for each sub-topic related to Trees.
I haven't shared any solutions because there are plenty of excellent posts already written for each problem by the Leetcode community.

Hope you find this useful in your interview prep journey! :)

BST Traversal

Valid BST from Preorder
Kth Smallest Element In Tree
2-Sum Binary Tree
BST Iterator
Recover Binary Search Tree

Simple Tree Ops

Balanced Binary Tree

Tree Construction

Convert Sorted Array to Binary Search Tree
Construct Binary Tree from Preorder and Inorder Traversal
Construct Binary Tree from Inorder and Postorder Traversal

Inplace change

Invert Binary Tree

Traversal

Binary Tree Vertical Order Traversal
Diagonal Traverse
Binary Tree Inorder Traversal
Binary Tree Preorder Traversal
Binary Tree Postorder Traversal

Root to leaf

Maximum Depth of Binary Tree
Sum Root to Leaf Numbers
Path Sum II
Minimum Depth of Binary Tree

2 trees

Merge Two Binary Trees
Symmetric Tree
Same Tree

Lowest Common Ancestor of a Binary Tree

Linkedlist tree

Flatten Binary Tree to Linked List

Segment tree

Queue Reconstruction by Height

Level Order

Binary Tree Right Side View
Cousins in Binary Tree
Binary Tree Level Order Traversal II
Binary Tree Zigzag Level Order Traversal
Populating Next Right Pointers in Each Node II

Trie

Implement Trie (Prefix Tree)

Credits

  • IB For sorting problems by topic
  • IB extension for Google Chrome for mappping all the problems to leetcode
Comments (5)