Trees & recursive traversal
Ask what one subtree returns, then combine the left and right answers.
Start the first lesson ↗RECALLED
Each node’s answer depends only on inverted child subtrees.
Invert Binary Tree
Each node’s answer depends only on inverted child subtrees.
Maximum Depth of Binary Tree
A node’s depth is one plus the deeper child depth.
Same Tree
Both corresponding nodes must agree before their children can agree.
Subtree of Another Tree
Every source node is a possible root; equality is a separate recursive question.
Lowest Common Ancestor of a Binary Search Tree
BST ordering shows when both targets lie on the same side.
Binary Tree Level Order Traversal
A queue boundary separates the current level from the next.
Validate Binary Search Tree
Each ancestor contributes a lower or upper bound, not just the parent.
Kth Smallest Element in a BST
In-order traversal visits BST values in ascending order.
Construct Binary Tree from Preorder and Inorder Traversal
Preorder chooses the root; inorder splits left and right subtrees.
Binary Tree Maximum Path Sum
A parent can extend at most one child branch, while the global answer may join two.
Serialize and Deserialize Binary Tree
Null markers make traversal shape unambiguous.