#C7595. Minimum Maximum Skill Difference
Minimum Maximum Skill Difference
Minimum Maximum Skill Difference
You are given T test cases. In each test case, there are N participants with given skill levels. Your task is to compute the minimum possible value of the maximum skill difference when comparing two adjacent players after sorting the skills in non-decreasing order.
In other words, for each test case you should:
- Sort the list of skill levels.
- Find the minimum difference between any two consecutive elements.
This minimum difference is the answer for that test case.
Note: The input is given from stdin
and the output should be printed to stdout
.
inputFormat
The first line contains an integer T
denoting the number of test cases.
Then for each test case, the input is as follows:
- The first line contains an integer
N
– the number of participants. - The second line contains
N
space separated integers representing the skill levels.
outputFormat
For each test case, output a single line containing the minimum value among the differences between any two adjacent skill levels in the sorted order.
## sample2
4
1 5 3 9
6
8 1 7 4 6 2
2
1
</p>