Given the root of a binary search tree and two values p and q that exist in it, return the value of their lowest common ancestor — the deepest node that has both p and q in its subtree (a node can be its own descendant).
The BST property tells you which way to go without searching both sides: if both targets are smaller than the current node, the answer is in the left subtree; if both are larger, it's in the right; otherwise you've found the split point.
Example
Input: root = [6, 2, 8, 0, 4, 7, 9, null, null, 3, 5], p = 2, q = 8
Output: 6