Tree #01
Medium Lowest Common Ancestor of a Binary Tree
Find the lowest node in a binary tree whose subtree contains both target nodes.
Solved treedfslowest common ancestor
Recursive structure, subtree information, and ancestor-style reasoning. The focus here is postorder recursion and tree invariants. Official LeetCode problems are linked on every page instead of being mirrored here.
Every page keeps the problem summary, recognition pattern, reasoning, pitfalls, and the exact C++ source used on the site.
Find the lowest node in a binary tree whose subtree contains both target nodes.