Minimum and Maximum 2
InterviewTime limit1sMemory limit256 MB
For each of T test cases, read N integers and print the smallest and largest value separated by a space.
- Level
Easy1 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Problem
You are given N integers. Write a program that finds the minimum and the maximum.
Input
The first line gives the number of test cases T (1 ≤ T ≤ 10). Each test case consists of two lines.
The first line of each test case gives the number of integers N (1 ≤ N ≤ 1,000,000). The second line gives N integers separated by spaces. Every integer is greater than or equal to -1,000,000 and less than or equal to 1,000,000.
Output
For each test case, print the minimum and the maximum of the given N integers, separated by a space, one test case per line in order.