Medium Accuracy: 36.61% Submissions: 3619 Points: 4

Given an array of size n containing positive integers n and a number k,The absolute difference between values at indices i and j is |a[i] – a[j]|. There are n*(n-1)/2 such pairs and you have to print the kth smallest absolute difference among all these pairs.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer n denoting the size of the array. Then next line contains n space separated integers forming the array. The last line contains the integer k.

Output:
Print the kth smallest absolute difference among all these pairs.

Constraints:
1<=T<=10^5
1<=N<=10^5
1<=a[i]<=10^5
1 <= k <= n*(n-1)/2