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, recursively search left and right subtrees for nodes p and q. If both sides return non-null, root is LCA. Otherwise, return the non-null side.