#C2378. Maximum Absolute Difference

    ID: 45687 Type: Default 1000ms 256MiB

Maximum Absolute Difference

Maximum Absolute Difference

You are given several test cases. For each test case, you are given an array of integers. Your task is to compute the maximum absolute difference between any two elements in the array, which equivalently can be computed as the absolute difference between the maximum and minimum value in the array. In mathematical terms, if the array is \(A\), you should output

[ \text{result} = \left| \max(A) - \min(A) \right| ]

For each test case, print the result on a separate line.

inputFormat

The first line contains an integer \(T\) denoting the number of test cases. For each test case:

  • The first line contains an integer \(N\), the number of elements in the array.
  • The second line contains \(N\) space-separated integers representing the array elements.

outputFormat

For each test case, output a single line containing the maximum absolute difference between any two elements of the array.

## sample
2
5
1 2 3 4 5
4
-1 -2 -3 -4
4

3

</p>