Objective: – Find the Lowest Common Ancestor of two given nodes in a Binary Tree
What is Lowest Common Ancestor
In a given binary tree, The lowest common ancestor of two nodes n1 and n2 will be a node X such that node X will be the lowest node who has n1 and n2 as its descendants.
Similar Problem: Lowest Common Ancestor in a Binary Search Tree.
Input: A binary Tree and two nodes n1 and n2.