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.
Example BST is not a BST, right child of 2 should be 4, not 3. Please fix this confusion! Correct example for 1,2,3,4,5,6 with 2 as root is follows, which means LCA for 4 and 6 would be 2:
2
/ \
1 4
/ \
3 5
\
6
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Binary Search Tree : Lowest Common Ancestor
You are viewing a single comment's thread. Return to all comments →
Example BST is not a BST, right child of 2 should be 4, not 3. Please fix this confusion! Correct example for 1,2,3,4,5,6 with 2 as root is follows, which means LCA for 4 and 6 would be 2: