Lowest Common Ancestor of a Binary Search Tree

 

235. Lowest Common Ancestor of a Binary Search Tree

Solutions

Use the definition of BST. The ancestor can only be updated when p and q are in the same subtree of the current node.