#K81032. Max Difficulty Marathon

    ID: 35663 Type: Default 1000ms 256MiB

Max Difficulty Marathon

Max Difficulty Marathon

You are given an integer $T$ representing the number of test cases. For each test case, you are provided with an integer $n$ representing the number of checkpoints in the marathon, followed by $n$ integers which describe the difficulty levels at these checkpoints.

Your task is to compute the maximum difficulty of the marathon for each test case. The maximum difficulty is defined as the difference between the highest and the lowest difficulty values among the checkpoints. In mathematical terms, if a test case has difficulties $a_1, a_2, \dots, a_n$, you need to calculate:

$$\text{max_difficulty} = \max(a_1, a_2, \dots, a_n) - \min(a_1, a_2, \dots, a_n) $$

Output the result for each test case on a separate line.

inputFormat

The first line contains an integer $T$, the number of test cases. The description of each test case follows:

  • The first line of each test case contains an integer $n$, representing the number of checkpoints.
  • The second line contains $n$ space-separated integers denoting the difficulty levels of the checkpoints.

Input is read from stdin.

outputFormat

For each test case, output a single line containing the maximum difference between checkpoints (i.e. the maximum difficulty of the marathon). Output is written to stdout.

## sample
3
5
4 2 7 6 1
3
-5 -8 0
4
3 3 3 3
6

8 0

</p>