Nth Highest Number in Binary Search Tree

Given a binary search tree and an integer n, return node with the nth highest value.

Statement

Given the root of a binary search tree and an integer value n, find the node with the nth^{th} highest value.

Example

Consider the following BST as an example:

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.