LeetCode 510. Inorder Successor in BST II
原题链接在这里: https://leetcode.com/problems/inorder-successor-in-bst-ii/ 题目: Given a binary search tree and a node in it, find the in-order successor of that node in the BST. p p.val . You will have direct access to the node but not to the root of the tree. Each node will have a reference to its parent node. Example 1: Input: root = {"$id":"1","left":{"$id":"2","left":null,"parent":{"$ref":"1"},"right":null,"val":1},"parent":null,"right":{"$id":"3","left":null,"parent":{"$ref":"1"},"right":null,"val":3},"val":2} p = 1 Output: 2 Explanation: 1's in-order successor node is 2. Note that both p and the