Post Order Processing
or Bottom up recursion
Traverse
563. Binary Tree Tilt
The tilt of a tree node is the absolute difference between the sum of all left subtree node values and all right subtree node values. The tilt of the entire tree is the sum of all node tilts.
110. Balanced Binary Tree
Check if a binary tree is height-balanced. A height-balanced tree is one where the left and right subtrees of every node differ in height by no more than 1.
Children Sum in a Binary Tree
Check if a binary tree follows the children sum property. In this property, the sum of values of the left child and right child should be equal to the value of their parent node for all nodes.
1973. Count Nodes Equal to Sum of Descendants
Count the number of nodes whose value is equal to the sum of the values of their descendants. A descendant of a node is any node that is on the path from the node to a leaf.
508. Most Frequent Subtree Sum
Find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values formed by the subtree rooted at that node (including the node itself).
543. Diameter of Binary Tree
The diameter is the length of the longest path between any two nodes, which may or may not pass through the root. At each node, the longest path through it is left_height + right_height. A single post-order recursion returns each node's height while tracking the best diameter seen so far.
366. Find Leaves of Binary Tree
Collect and remove leaves layer by layer until the tree is empty. The key insight is that a node's "collection layer" equals its height (distance to its deepest leaf). A post-order recursion computes each node's height and groups node values by that height, so all nodes removed together share the same height.
250. Count Univalue Subtrees
A univalue subtree is one where every node has the same value. A post-order recursion returns whether the subtree rooted at a node is univalue: it is, when the node matches each existing child and both child subtrees are themselves univalue. Each time that holds, the running count is incremented.
2265. Count Nodes Equal to Average of Subtree
1120. Maximum Average Subtree
2331. Evaluate Boolean Binary Tree
LCA and its Variants
236. Lowest Common Ancestor of a Binary Tree
1644. Lowest Common Ancestor of a Binary Tree II
1676. Lowest Common Ancestor of a Binary Tree IV
1650. Lowest Common Ancestor of a Binary Tree III
1740. Find Distance in a Binary Tree
2509. Cycle Length Queries in a Tree
1257. Smallest Common Region
1123. Lowest Common Ancestor of Deepest Leaves
865. Smallest Subtree with all the Deepest Nodes
Manipulate Tree
Transform to Sum Tree
Transform a binary tree into a sum tree where each node contains the sum of left and right subtrees in the original tree.