Challenge: Find Max

Let’s find the maximum value in a BST.

Problem

Find the node with the maximum value in a BST.

Input

A BST.

Output

The node with the maximum value.

Sample input

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