Given an integer array and a non-negative integer k, count all distinct pairs with difference equal to k, i.e., A[ i ] - A[ j ] = k.
The first line of input consists number of the test cases. The description of T test cases is as follows:
The first line of each test case contains the size of the array, the second line has the elements of the array and the third line consists of the difference k.
In each separate line print the number of times difference k exists between the elements of the array.
1 ≤ T ≤ 100
1 ≤ N≤ 100
0 ≤ A[i] ≤ 10000
1 5 4 1 2
1 1 1
1 5 3
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.