


The first line of input contains an integer ‘T,’ denoting the number of test cases. The test cases follow.
The first line of each test case contains two space-separated integers, ‘N’ and ‘K’, denoting the number of elements in the array and the index of the largest number to be found respectively.
For each test case, print an integer denoting the Kth largest number.
Print the output of each test case in a separate line.
You are not required to print the expected output; it has already been taken care of. Just implement the function.
1<= T <= 50
1 <= K <= N <= 10^4
1 <= array[i] <= 10^5
Time Limit: 1 sec
The idea is to sort the elements and return the kth largest element among them.
The steps are as follows:
We can insert the elements in a priority queue and remove the k top elements to get our desired result.
The steps are as follows: