Concept Flow - Lowest Common Ancestor in Binary Tree
Start at root node
Check if root is null or matches p or q
Yes
Return root
No
Recurse left subtree
Recurse right subtree
If left and right both non-null
Return root as LCA
Return non-null child (left or right)
Start from root, check if it matches either target node or is null. Recurse left and right. If both sides return nodes, current root is LCA. Otherwise, return the non-null side.