89: Closest value in a binary search tree

Given a non-empty binary search tree and the target value, return the closest value to the target value

 

Example 1

Input:        4    target = 4.8
             / \
            2   5

Output: 5

Example 2

Input:        1    target = 0.8
               \  
                3 

Output: 1
Difficulty:Easy
Topic:Tree
Problem #:89