We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I think you're traversing the wrong side of the tree. If the value at the root is larger than both v1 and v2, you should traverse the root.left instead of root.right
Binary Search Tree : Lowest Common Ancestor
You are viewing a single comment's thread. Return to all comments →
I think you're traversing the wrong side of the tree. If the value at the root is larger than both v1 and v2, you should traverse the root.left instead of root.right
HackerRank solutions.