#K70922. Smallest Beauty
Smallest Beauty
Smallest Beauty
You are given an integer sequence. Define the beauty for a pair of elements \(a\) and \(b\) as \(|a - b|\). Your task is to determine the smallest possible beauty among all pairs of distinct elements in the sequence. Note that each test case is guaranteed to have at least two elements.
Definition:
For any two elements \(a\) and \(b\), the beauty is \[ \text{beauty}(a,b) = |a - b| \]
inputFormat
The input begins with an integer \(t\) (the number of test cases). Each test case consists of two lines:
- The first line contains an integer \(n\), the number of elements in the sequence.
- The second line contains \(n\) space-separated integers representing the sequence.
outputFormat
For each test case, output a single line containing one integer — the smallest beauty (i.e. the smallest absolute difference between any two distinct elements in the sequence).
## sample1
5
3 1 4 1 5
0