Lowest Common Ancestor in a BST
Given a Binary Search Tree (with all values unique) and two node values. Find the Lowest Common Ancestors of the two nodes in the BST.
- Time : O(d)
- Space : O(d)
c++
1 | bool inRange(int mi, int ma, int target) { |