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 as LCA candidate
No
Recurse left subtree
Recurse right subtree
If both left and right return non-null
Yes
Current node is LCA
No
Return non-null child
End
Start from root, check if it matches p or q or is null. Recurse left and right. If both sides find nodes, current is LCA. Else return the found node.
