#K84452. Find Maximum and Minimum Benches
Find Maximum and Minimum Benches
Find Maximum and Minimum Benches
Given several test cases, each representing a series of parks with a specific number of benches in each, your task is to determine the maximum and minimum bench counts for each test case.
The input starts with an integer \(T\) denoting the number of test cases. For each test case, the first line contains an integer \(n\) which indicates the number of parks. The following line contains \(n\) space-separated integers, where each integer represents the number of benches in a park.
For each test case, output two integers separated by a space: the maximum and the minimum number of benches among the parks. Each test case result should be printed on a new line.
Example: For a test case with input:
5 12 3 9 16 7
the output should be:
16 3
inputFormat
The first line of the input contains a single integer \(T\) (\(1 \leq T \leq 100\)), the number of test cases.
Each test case consists of two lines:
- The first line contains a single integer \(n\) (\(1 \leq n \leq 10^5\)), the number of parks.
- The second line contains \(n\) space-separated integers \(b_1, b_2, \dots, b_n\) (\(0 \leq b_i \leq 10^9\)), representing the number of benches in each park.
It is guaranteed that the total number of parks over all test cases does not exceed \(10^6\).
outputFormat
For each test case, output a single line containing two integers: the maximum and minimum number of benches among the parks, separated by a space.
## sample1
3
7 4 9
9 4
</p>