#K5596. Maximum Absolute Difference Pairs
Maximum Absolute Difference Pairs
Maximum Absolute Difference Pairs
Given \(T\) test cases, each consists of an array of \(n\) integers (which may include negative values). For each test case, your task is to find two distinct integers from the array such that their absolute difference is maximized. Notice that the maximum absolute difference is achieved by taking the minimum value \(a_{\min}\) and the maximum value \(a_{\max}\) of the array, since \(|a_{\max} - a_{\min}|\) is largest.
For each test case, output the pair \(a_{\min}\) and \(a_{\max}\) separated by a space.
Note: Use standard input (stdin) for reading input and standard output (stdout) for printing the result.
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 elements in the array), and the second line contains (n) space-separated integers.
outputFormat
For each test case, output a single line containing two space-separated integers: the minimum and the maximum number from the array, respectively.## sample
3
5
1 -3 4 8 -6
3
100 200 -300
4
3 9 -9 7
-6 8
-300 200
-9 9
</p>