Given a binary search tree and a number k , write a program to find the largest number in the binary search tree that is less than or equal to k .

Problem Note

If the largest element exists, return its value, else return -1.

Example 1

          27         
          /  \       
         14   35
        / \
       10   19
      / \
     31  42
For the above given binary tree
Input: k = 30
Output: 27
Explanation: 10, 14, 19, and 27 are less than or equal to 30. The largest amongst these numbers is 27.