Method Explained LCA(CODE THIS ON YOUR OWN)


#1

first find if the 2 nodes are present in the tree or not
(Figure why to check this on your own)

Now,

if root is equal to B or C
ancestor found
as other value(B or C) found will be ALWAYS below this
else
do what we do in most recursion q

Lans=LCA(left)
Rans=LCA(right)

these tells us weather we have found the B or C in the left and the right subtree

if both B and C found,root is the anscestor

else NULL(think why)