P16639 [CodeChef] EID
普及-
题目描述

------Read problems statements in Hindi,
Mandarin chinese
, Russian and Vietnamese as well. ------

During Eid, it's a tradition that each father gives his kids money which they can spend on entertainment.

Chef has $N$ coins; let's denote the value of coin $i$ by $v_{i}$. Since today is Eid, Chef is going to give one coin to each of his two children. He wants the absolute value of the difference between the values of coins given to the two children to be as small as possible, so that he would be as fair as possible.

Help Chef by telling him the minimum possible difference between the values of the coins given to the two children. Of course, Chef cannot give the same coin to both children.

------ Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first line of each test case contains a single integer $N$.
The second line contains $N$ space-separated integers $v_{1}, v_{2}, \dots, v_{N}$.

------ Output ------
For each test case, print a single line containing one integer — the minimum possible difference.

------ Constraints ------
$1 ≤ T ≤ 100$
$2 ≤ N ≤ 10^{5}$
the sum of $N$ in all test cases does not exceed $5 \cdot 10^{5}$
$1 ≤ v_{i} ≤ 10^{6}$ for each valid $i$

------ Subtasks ------
Subtask #1 (30 points): the sum of $N$ in all test cases does not exceed $2,000$

Subtask #2 (70 points): original constraints

----- Sample Input 1 ------
2
3
1 4 2
3
1 3 3
----- Sample Output 1 ------
1
0
----- explanation 1 ------
Example case 1: Chef gives the coin with value $1$ to his first child and the coin with value $2$ to the second child, so the answer is $2-1 = 1$.

Example case 2: Chef gives each of his children a coin with value $3$, so the difference is $0$.

输入格式

见题面

输出格式

见题面

样例输入
2 3 1 4 2 3 1 3 3
样例输出
1 0