Medium
Given a binary search tree and two node values p and q present in it, return the value of their lowest common ancestor — the deepest node that has both as descendants (a node can be a descendant of itself).
Input: root = [6,2,8,0,4,7,9,null,null,3,5], p = 2, q = 8 Output: 6
Input: root = [6,2,8,0,4,7,9,null,null,3,5], p = 2, q = 4 Output: 2