You are viewing a single comment's thread. Return to all comments →
You will have to return node A, because for the Lowest common ancestor problem, every node is considered a descendant of itself.
So if A is an ancestor of B, your lowest common ancestor would have to be A. Hope this clarifies your question.
Seems like cookies are disabled on this browser, please enable them to open this website
Binary Search Tree : Lowest Common Ancestor
You are viewing a single comment's thread. Return to all comments →
You will have to return node A, because for the Lowest common ancestor problem, every node is considered a descendant of itself.
So if A is an ancestor of B, your lowest common ancestor would have to be A. Hope this clarifies your question.