You are given the root of a Binary Search Tree (BST) and a target node. Your task is to find its inorder successor.
The inorder successor of a node is the node with the smallest value greater than the target's value.
If no such node exists, return null.
Input: root = [5,3,8,1,4,null,9], target = 4
Output: 5
Explanation: In inorder traversal (1, 3, 4, 5, 8, 9), the value that immediately follows 4 is 5.
Input: root = [5,3,8,1,4,null,9], target = 9
Output: null
Explanation: 9 is the largest value in the BST, so it has no inorder successor.
Input: root = [2,1,3], target = 1
Output: 2
Explanation: The inorder sequence is 1, 2, 3, so the successor of 1 is 2.
Sign in to write, run, and submit your solution against the full test suite.