Test Cases
Attempts
Output
Output will appear here after you submit your code :)
Given the root
of a Binary Search Tree (BST) and an integer target
, find the value of the in-order successor of the node that has the value target
. The in-order successor of a node p
is the node with the smallest key greater than p.key
. If the target
node has no in-order successor (i.e., it is the largest element in the tree), return -1
. You can assume that all values in the BST
are unique and the target
value is guaranteed to exist in the tree.