#C2471. Minimum Difference in Tree Heights
Minimum Difference in Tree Heights
Minimum Difference in Tree Heights
You are given multiple test cases. In each test case, you are provided with the number of trees and a list of integer values representing the heights of each tree. Your task is to determine the minimum absolute difference between the heights of any two trees within each test case.
For a given test case with tree heights (h_1, h_2, \ldots, h_N), you should compute: [ \min_{1 \le i < j \le N} |h_i - h_j| ]
If two trees have the same height, the minimum difference is (0). The results for each test case should be printed on a new line.
inputFormat
The input is read from standard input (stdin). The first line contains an integer (T) representing the number of test cases. For each test case:
- The first line contains an integer (N), the number of trees.
- The second line contains (N) space-separated integers representing the heights of the trees.
outputFormat
For each test case, output a single integer on a new line indicating the minimum absolute difference between any two tree heights.## sample
1
5
3 8 1 5 2
1
</p>