#K39982. Minimum Adjacent Coin Difference

    ID: 26541 Type: Default 1000ms 256MiB

Minimum Adjacent Coin Difference

Minimum Adjacent Coin Difference

You are given a list of coin values for each test case. Your task is to arrange the coins in non-decreasing order and then determine the minimum absolute difference between any two consecutive coins. If a test case has only one coin, output (\infty) (infinity).

For example, if the input coin values are [4, 8, 6, 3, 15], then after sorting them as [3, 4, 6, 8, 15], the differences between consecutive coins are (4-3=1), (6-4=2), (8-6=2), and (15-8=7). The minimum difference is (1).

inputFormat

The first line contains an integer (T) denoting the number of test cases. Each test case consists of two lines:
- The first line contains an integer (N), the number of coins.
- The second line contains (N) space-separated integers representing the coin values.

outputFormat

For each test case, output a single line containing the minimum absolute difference between any two consecutive coins after sorting the values. If there is only one coin in the test case, output (\infty) (infinity).## sample

5
5
4 8 6 3 15
4
1 3 6 10
2
1 1000000000
3
3 3 3
1
5
1

2 999999999 0 inf

</p>