30:00
Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST.
The number of nodes is in the range [2,105][2, 10^5][2,105].
−109≤Node.val≤109-10^9 \leq \text{Node.val} \leq 10^9−109≤Node.val≤109
All Node.val are unique.
Node.val
p != q
p and q will exist in the BST.
p
q
Start at root
6
2
8
0
4
7
9
3
5