Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree root and two nodes p and q, return their lowest common ancestor.

The lowest common ancestor is the deepest node that is an ancestor of both nodes, and a node can be its own ancestor.

Examples
Input: [[6,2,8,0,4,7,9,null,null,3,5],2,8]
Output: 6
Hints

Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree `root` and two nodes `p` and `q`, return their lowest common ancestor.