Given the root of a binary search tree and an integer k (1-indexed), return the k-th smallest key in the BST. The input gives a level-order BST array and k separated by ' | '.
Input: A level-order BST array and k, separated by ' | '.
Output: Integer — the k-th smallest key.
Input: [8,3,10,1,6,null,14] | 3
Output: 6
Explanation: Sorted keys; 3rd smallest is 6.Input: [4,2,7,1,3] | 1
Output: 1
Explanation: Smallest key.Input: [5] | 1
Output: 5
Explanation: Single node.1<=k<=nodes<=10^4valid BST