84: Maximum value in a binary search tree

Given a binary search tree, return the maximum value

 

Example 1

Input:        4  
             / \
            2   5

Output: 5

Example 2

Input:     1  
            \  
             3 

Output: 3
Difficulty:Easy
Topic:Tree
Problem #:84