You are given a binary search tree and a number k. List all its values from the smallest to the biggest, and return the one at place k. Counting starts at 1, so k = 1 means the smallest value.
How the judge passes the data
Examples
Example 1:
Input: root = [40,20,60,10,30,50,70], k = 6
Output: 60
Explanation: The values in sorted order are 10, 20, 30, 40, 50, 60, 70. The 6th is 60.
Example 2:
Input: root = [8,3,10,1,6,null,14,null,null,4,7,13], k = 5
Output: 7
Explanation: The values in sorted order are 1, 3, 4, 6, 7, 8, 10, 13, 14. The 5th is 7.