What is the lowest common ancestor of 5 and 4 in this binary tree

62 Views Asked by At

Binary tree

Binary tree

What is the lowest common ancestor of 5 and 4 in the binary tree above, considering we allow a node to be a descendant of itself. Wouldn't it be 3? if not, what would it be and why?

1

There are 1 best solutions below

3
On BEST ANSWER

As we allow a node to be a descendant of itself, LCA will be 5.