Write an algorithm to find the "next" node (i.e., in-order successor) of a given node in a binary search tree.
Return null
if there's no "next" node for the given node.
Example 1:
Input: root = [2,1,3], p = 1
2
/ \
1 3
Output: 2
Example 2:
Input: root = [5,3,6,2,4,null,null,1], p = 6
5
/ \
3 6
/ \
2 4
/
1
Output: null