Lets say my tree is
[1,2,3] , so 1 is root and 2 is left node of 1 and 3 is left node of 3. I pass to the method the following
lca(root, new Node(2), new Node (4) ) , the answer should be null , right?
Point is, that one of the nodes, Node (4) doesn't exists in the tree. In that case, the answer should be null