Given the root node of a binary search tree and a number k, find out the kth largest element (1-indexed) in the BST.
Note: You can assume that k <= number of nodes.
The first line contains an integer T denoting the number of test cases.
For each test case, the input has 2 lines:
For each test case, the output contains an integer with the value of the kth largest element in BST.
4
9
2 1 3 -1 -1 -1 5 4 7
4
7
6 3 21 -1 -1 -1 89
1
12
8 3 9 -1 4 -1 10 -1 -1 -1 12 11
7
4
28 14 -1 11
2
3
89
3
14
1 <= T <= 10
1 <= n <= 105
1 <= node value <= 109