Trees
►
Pattern 1: Distance Between Nodes
→ Binary Tree Distance Queries
→ Tree Diameter
→ Lowest Common Ancestor
→ Kth Ancestor of a Tree Node
→ Distance to Root
attern 2: Sum of Distances
P
→ Sum of Distances in Tree
→ Tree Distances II
→ Sum of Root to Leaf Numbers
→ Tree Tilt
→ Diameter of Binary Tree
attern 3: Subtree Queries
P
→ Subtree Sum Queries
→ Company Queries II
→ Subtree Size Queries
→ Path Sum III
→ Count Univalue Subtrees
attern 4: Binary Lifting (LCA)
P
→ Lowest Common Ancestor
→ Binary Lifting Template
→ Jump Game in Tree
→ Tree Ancestry Queries
→ Tree Path Queries
attern 5: Tree DP
P
→ House Robber III
→ Tree Matching
→ Tree DP Template
→ Largest Independent Set
→ Maximum Path Sum
attern 6: Rerooting Technique
P
→ Tree Distances I
→ Tree Distances II
→ Sum of Distances in Tree
→ Rerooting DP Template
→ Tree Diameter
attern 7: Path Queries
P
→ Path Sum
→ Path Sum II
→ Longest Path in Tree
→ Query on a Tree
→ Kth Smallest Path Sum
attern 8: Tree Construction
P
→ Construct Binary Tree from Preorder/Inorder
→ Serialize and Deserialize Binary Tree
→ Reconstruct Itinerary
→ Build Tree from Leaf Sequence
→ Recover Binary Search Tree