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.
Hmm I never thought to use a value test. I used a recursive inTree() function to test if a value was in a particular subtree. The running times of all test cases was 0 so the recursion didn't hurt in this case.
Binary Search Tree : Lowest Common Ancestor
You are viewing a single comment's thread. Return to all comments →
Hmm I never thought to use a value test. I used a recursive inTree() function to test if a value was in a particular subtree. The running times of all test cases was 0 so the recursion didn't hurt in this case.
https://www.hackerrank.com/challenges/binary-search-tree-lowest-common-ancestor/submissions/code/25912799