#K46282. Minimum Maximal Skill Difference

    ID: 27942 Type: Default 1000ms 256MiB

Minimum Maximal Skill Difference

Minimum Maximal Skill Difference

You are given a number of test cases. For each test case, you are given an integer n representing the number of players followed by n integers which denote the players' skills. Your task is to compute the minimum difference between any two adjacent skills after sorting the list of skills. Mathematically, if the sorted skills are \(a_1, a_2, \ldots, a_n\), you need to compute:

\[ \min_{1 \le i < n}(a_{i+1} - a_i) \]

Input will be given via standard input (stdin) and the results must be printed to standard output (stdout), with one result per test case.

inputFormat

The first line contains an integer (T) denoting the number of test cases. For each test case, the first line contains an integer (n), the number of players. The subsequent line contains (n) space-separated integers representing the players' skills.

outputFormat

For each test case, output a single line containing the minimum difference between any two consecutive skills after sorting.## sample

3
4
1 3 5 9
6
8 1 7 4 3 9
8
12 10 9 5 6 14 7 11
2

1 1

</p>