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 recursion return non-null
Current node is LCA
Return non-null child from left or right
End
Start from root, check if it matches either node. Recurse left and right. If both sides find nodes, current is LCA. Otherwise, return the found node.