Search
⌘K

Leetcode 510. Inorder Successor in BST II

Given a node in a binary search tree where each node has left, right, and parent pointers (and you may not have the root), find the node that appears immediately after it in an in-order traversal. Key insight: the successor is either the leftmost node in its right subtree or the first ancestor for which the node lies in its left subtree.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.