> For the complete documentation index, see [llms.txt](https://mayanktyagi3111.gitbook.io/interview-prep/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mayanktyagi3111.gitbook.io/interview-prep/trees.md).

# Trees

- [Construct a binary tree from in-order and level order traversals](https://mayanktyagi3111.gitbook.io/interview-prep/trees/construct-a-binary-tree-from-in-order-and-level-order-traversals.md)
- [Next Greater Number BST](https://mayanktyagi3111.gitbook.io/interview-prep/trees/next-greater-number-bst.md)
- [Balanced Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/balanced-binary-tree.md)
- [Same Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/same-tree.md)
- [Symmetric Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/symmetric-tree.md)
- [Inorder Traversal of Cartesian Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/inorder-traversal-of-cartesian-tree.md)
- [Convert Sorted Array to Binary Search Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/untitled.md)
- [Construct Binary Tree from Inorder and Postorder Traversal](https://mayanktyagi3111.gitbook.io/interview-prep/trees/construct-binary-tree-from-inorder-and-postorder-traversal.md)
- [Construct Binary Tree from Preorder and Inorder Traversal](https://mayanktyagi3111.gitbook.io/interview-prep/trees/construct-binary-tree-from-preorder-and-inorder-traversal.md)
- [Invert Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/invert-binary-tree.md)
- [Kth Smallest Element in a BST](https://mayanktyagi3111.gitbook.io/interview-prep/trees/kth-smallest-element-in-a-bst.md)
- [Two Sum IV](https://mayanktyagi3111.gitbook.io/interview-prep/trees/two-sum-iv.md)
- [Binary Search Tree Iterator](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-search-tree-iterator.md)
- [Recover Binary Search Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/recover-binary-search-tree.md)
- [Binary Tree Inorder Traversal](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-tree-inorder-traversal.md)
- [Binary Tree Postorder Traversal](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-tree-postorder-traversal.md)
- [Binary Tree Preorder Traversal](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-tree-preorder-traversal.md)
- [Binary Tree Zigzag Level Order Traversal](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-tree-zigzag-level-order-traversal.md)
- [Populating Next Right Pointers in Each Node](https://mayanktyagi3111.gitbook.io/interview-prep/trees/populating-next-right-pointers-in-each-node.md)
- [Populating Next Right Pointers in Each Node II](https://mayanktyagi3111.gitbook.io/interview-prep/trees/populating-next-right-pointers-in-each-node-ii.md)
- [Path Sum](https://mayanktyagi3111.gitbook.io/interview-prep/trees/path-sum.md)
- [Path Sum II](https://mayanktyagi3111.gitbook.io/interview-prep/trees/path-sum-ii.md)
- [Path Sum III](https://mayanktyagi3111.gitbook.io/interview-prep/trees/path-sum-iii.md)
- [Sum Root to Leaf Numbers](https://mayanktyagi3111.gitbook.io/interview-prep/trees/sum-root-to-leaf-numbers.md)
- [Smallest String Starting From Leaf](https://mayanktyagi3111.gitbook.io/interview-prep/trees/smallest-string-starting-from-leaf.md)
- [Construct Binary Search Tree from Preorder Traversal](https://mayanktyagi3111.gitbook.io/interview-prep/trees/construct-binary-search-tree-from-preorder-traversal.md)
- [Construct BST from Postorder](https://mayanktyagi3111.gitbook.io/interview-prep/trees/construct-bst-from-postorder.md)
- [Convert Level Order Traversal to BST](https://mayanktyagi3111.gitbook.io/interview-prep/trees/untitled-1.md)
- [Maximum Depth of Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/maximum-depth-of-binary-tree.md)
- [Minimum Depth of Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/minimum-depth-of-binary-tree.md)
- [Binary Tree Level Order Traversal](https://mayanktyagi3111.gitbook.io/interview-prep/trees/untitled-2.md)
- [Diagonal Traversal](https://mayanktyagi3111.gitbook.io/interview-prep/trees/diagonal-traversal.md)
- [Vertical Order Traversal of a Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/vertical-order-traversal-of-a-binary-tree.md)
- [Binary Tree Right Side View](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-tree-right-side-view.md)
- [Left View of Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/left-view-of-binary-tree.md)
- [Boundary Traversal of binary tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/boundary-traversal-of-binary-tree.md)
- [Construct Binary Tree from Parent Array](https://mayanktyagi3111.gitbook.io/interview-prep/trees/construct-binary-tree-from-parent-array.md)
- [Maximum Binary Tree II](https://mayanktyagi3111.gitbook.io/interview-prep/trees/maximum-binary-tree-ii.md)
- [Delete Leaves With a Given Value](https://mayanktyagi3111.gitbook.io/interview-prep/trees/delete-leaves-with-a-given-value.md)
- [Most Frequent Subtree Sum](https://mayanktyagi3111.gitbook.io/interview-prep/trees/most-frequent-subtree-sum.md)
- [Flatten Binary Tree to Linked List](https://mayanktyagi3111.gitbook.io/interview-prep/trees/flatten-binary-tree-to-linked-list.md)
- [Least Common Ancestor](https://mayanktyagi3111.gitbook.io/interview-prep/trees/least-common-ancestor.md)
- [Maximum width of a binary tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/maximum-width-of-a-binary-tree.md)
- [Maximum Width of Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/maximum-width-of-binary-tree.md)
- [Binary Tree Pruning](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-tree-pruning.md)
- [Find Bottom Left Tree Value](https://mayanktyagi3111.gitbook.io/interview-prep/trees/find-bottom-left-tree-value.md)
- [Maximum Product of Splitted Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/maximum-product-of-splitted-binary-tree.md)
- [Recover a Tree From Preorder Traversal](https://mayanktyagi3111.gitbook.io/interview-prep/trees/recover-a-tree-from-preorder-traversal.md)
- [Reverse alternate levels of a perfect binary tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/reverse-alternate-levels-of-a-perfect-binary-tree.md)
- [Find Largest Value in Each Tree Row](https://mayanktyagi3111.gitbook.io/interview-prep/trees/find-largest-value-in-each-tree-row.md)
- [Shortest Unique Prefix](https://mayanktyagi3111.gitbook.io/interview-prep/trees/shortest-unique-prefix.md)
- [Implement Trie (Prefix Tree)](https://mayanktyagi3111.gitbook.io/interview-prep/trees/implement-trie-prefix-tree.md)
- [Foldable Binary Trees](https://mayanktyagi3111.gitbook.io/interview-prep/trees/foldable-binary-trees.md)
- [Convert a given tree to its Sum Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/convert-a-given-tree-to-its-sum-tree.md)
- [Perfect Binary Tree Specific Level Order Traversal](https://mayanktyagi3111.gitbook.io/interview-prep/trees/perfect-binary-tree-specific-level-order-traversal.md)
- [Change a Binary Tree so that every node stores sum of all nodes in left subtree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/change-a-binary-tree-so-that-every-node-stores-sum-of-all-nodes-in-left-subtree.md)
- [Convert a given Binary Tree to Doubly Linked List](https://mayanktyagi3111.gitbook.io/interview-prep/trees/convert-a-given-binary-tree-to-doubly-linked-list.md)
- [Binary Tree to a Circular Doubly Link List](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-tree-to-a-circular-doubly-link-list.md)
- [Maximum edge removal from tree to make even forest](https://mayanktyagi3111.gitbook.io/interview-prep/trees/maximum-edge-removal-from-tree-to-make-even-forest.md)
- [Print common nodes on path from root (or common ancestors)](https://mayanktyagi3111.gitbook.io/interview-prep/trees/print-common-nodes-on-path-from-root-or-common-ancestors.md)
- [Minimum Distance Between BST Nodes](https://mayanktyagi3111.gitbook.io/interview-prep/trees/minimum-distance-between-bst-nodes.md)
- [Find distance between two nodes of a Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/find-distance-between-two-nodes-of-a-binary-tree.md)
- [Populate Inorder Successor for all nodes](https://mayanktyagi3111.gitbook.io/interview-prep/trees/populate-inorder-successor-for-all-nodes.md)
- [Double Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/double-tree.md)
- [Binary Tree Maximum Path Sum](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-tree-maximum-path-sum.md)
- [Maximum Path Sum](https://mayanktyagi3111.gitbook.io/interview-prep/trees/maximum-path-sum.md)
- [Print all nodes at distance k from a given node](https://mayanktyagi3111.gitbook.io/interview-prep/trees/print-all-nodes-at-distance-k-from-a-given-node.md)
- [Binary Trees Custom Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-trees-custom-tree.md)
- [Tilt of Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/tilt-of-binary-tree.md)
- [Construct a special tree from given preorder traversal](https://mayanktyagi3111.gitbook.io/interview-prep/trees/construct-a-special-tree-from-given-preorder-traversal.md)
- [Sum of k smallest elements in BST](https://mayanktyagi3111.gitbook.io/interview-prep/trees/sum-of-k-smallest-elements-in-bst.md)
- [Check whether BST contains Dead End or not](https://mayanktyagi3111.gitbook.io/interview-prep/trees/check-whether-bst-contains-dead-end-or-not.md)
- [Binary Tree to Binary Search Tree Conversion](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-tree-to-binary-search-tree-conversion.md)
- [Remove nodes on root to leaf paths of length < K](https://mayanktyagi3111.gitbook.io/interview-prep/trees/remove-nodes-on-root-to-leaf-paths-of-length-less-than-k.md)
- [Find Height of Binary Tree represented by Parent array](https://mayanktyagi3111.gitbook.io/interview-prep/trees/find-height-of-binary-tree-represented-by-parent-array.md)
- [Vertical Sum in Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/vertical-sum-in-binary-tree.md)
- [Extract Leaves of a Binary Tree in a Doubly Linked List](https://mayanktyagi3111.gitbook.io/interview-prep/trees/extract-leaves-of-a-binary-tree-in-a-doubly-linked-list.md)
- [Longest ZigZag Path in a Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/longest-zigzag-path-in-a-binary-tree.md)
- [Validate Binary Search Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/validate-binary-search-tree.md)
- [Maximum Level Sum of a Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/maximum-level-sum-of-a-binary-tree.md)
- [Convert Sorted List to Binary Search Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/convert-sorted-list-to-binary-search-tree.md)
- [Merge Two Binary Trees](https://mayanktyagi3111.gitbook.io/interview-prep/trees/merge-two-binary-trees.md)
- [Diameter of Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/diameter-of-binary-tree.md)
- [Count Good Nodes in Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/count-good-nodes-in-binary-tree.md)
- [Serialize and Deserialize Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/serialize-and-deserialize-binary-tree.md)
- [Replace Words](https://mayanktyagi3111.gitbook.io/interview-prep/trees/replace-words.md)
- [Validate Binary Tree Nodes](https://mayanktyagi3111.gitbook.io/interview-prep/trees/validate-binary-tree-nodes.md)
- [Add One Row to Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/add-one-row-to-tree.md)
- [Insufficient Nodes in Root to Leaf Paths](https://mayanktyagi3111.gitbook.io/interview-prep/trees/insufficient-nodes-in-root-to-leaf-paths.md)
- [Pseudo-Palindromic Paths in a Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/pseudo-palindromic-paths-in-a-binary-tree.md)
- [Find Duplicate Subtrees](https://mayanktyagi3111.gitbook.io/interview-prep/trees/find-duplicate-subtrees.md)
- [Inorder Successor in BST](https://mayanktyagi3111.gitbook.io/interview-prep/trees/inorder-successor-in-bst.md)
- [Distribute Coins in Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/distribute-coins-in-binary-tree.md)
- [Delete Node in a BST](https://mayanktyagi3111.gitbook.io/interview-prep/trees/delete-node-in-a-bst.md)
- [Count Complete Tree Nodes](https://mayanktyagi3111.gitbook.io/interview-prep/trees/count-complete-tree-nodes.md)
- [Binary Tree Coloring Game](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-tree-coloring-game.md)
- [Delete Nodes And Return Forest](https://mayanktyagi3111.gitbook.io/interview-prep/trees/delete-nodes-and-return-forest.md)
- [Sum of Nodes with Even-Valued Grandparent](https://mayanktyagi3111.gitbook.io/interview-prep/trees/sum-of-nodes-with-even-valued-grandparent.md)
- [Deepest Leaves Sum](https://mayanktyagi3111.gitbook.io/interview-prep/trees/deepest-leaves-sum.md)
- [Cousins in Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/cousins-in-binary-tree.md)
- [Binary Search Tree to Greater Sum Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-search-tree-to-greater-sum-tree.md)
- [Stream of Characters](https://mayanktyagi3111.gitbook.io/interview-prep/trees/stream-of-characters.md)
- [Closest Leaf in a Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/closest-leaf-in-a-binary-tree.md)
- [Binary Tree Cameras](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-tree-cameras.md)
- [Lowest Common Ancestor of a Binary Search Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/lowest-common-ancestor-of-a-binary-search-tree.md)
- [Balance a Binary Search Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/balance-a-binary-search-tree.md)
- [Maximum Sum BST in Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/maximum-sum-bst-in-binary-tree.md)
- [Kth Ancestor of a Tree Node](https://mayanktyagi3111.gitbook.io/interview-prep/trees/kth-ancestor-of-a-tree-node.md)
- [Binary Tree Upside Down](https://mayanktyagi3111.gitbook.io/interview-prep/trees/binary-tree-upside-down.md)
- [Linked List in Binary Tree](https://mayanktyagi3111.gitbook.io/interview-prep/trees/linked-list-in-binary-tree.md)
- [LCA in a tree using Binary Lifting Technique](https://mayanktyagi3111.gitbook.io/interview-prep/trees/lca-in-a-tree-using-binary-lifting-technique.md)
- [Number of Nodes in the Sub-Tree With the Same Label](https://mayanktyagi3111.gitbook.io/interview-prep/trees/number-of-nodes-in-the-sub-tree-with-the-same-label.md)
- [Number of Good Leaf Nodes Pairs](https://mayanktyagi3111.gitbook.io/interview-prep/trees/number-of-good-leaf-nodes-pairs.md)
