#C3604. Minimum Sweetness Difference
Minimum Sweetness Difference
Minimum Sweetness Difference
You are given several test cases. For each test case, you are provided with an array of integers representing the sweetness levels of candies. Two friends are to receive one candy each. The task is to determine the minimum possible difference in sweetness between any two candies chosen.
To solve the problem, sort the array of sweetness values and then compute the minimum of the differences between every two consecutive candies. Mathematically, if the sorted array is (a_1, a_2, \ldots, a_N), then the answer for that test case is (\min_{2 \le i \le N} (a_i - a_{i-1})).
inputFormat
The first line contains an integer (T) representing the number of test cases.
For each test case, the first line contains an integer (N) denoting the number of candies. The next line contains (N) space-separated integers representing the sweetness levels of the candies.
outputFormat
For each test case, output a single line containing the minimum difference in sweetness between any two candies.## sample
3
3
1 5 3
5
1 9 3 8 5
4
10 20 30 40
2
1
10
</p>