64. Hottest and Coldest Day

Acceptance — 0 accepted 0 submissions

Easy
Arrays
No companies listed
The weather station in Shimla recorded the temperature every day for n days.

Find the highest and the lowest temperature.

Input Format
The first line has n.
The second line has n integers, the temperatures.

Output Format
Print the maximum and the minimum separated by a space.

Constraints
• 1 ≤ n ≤ 1000
• -50 ≤ temperature ≤ 50

Example 1

Input
5
12 -3 8 15 0
Output
15 -3

Explanation Hottest is 15 and coldest is -3.

Example 2

Input
3
-5 -10 -2
Output
-2 -10

Explanation All negative: max is -2, min is -10.

Example 3

Input
1
25
Output
25 25

Explanation With one day, it is both the hottest and the coldest.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
15 -3
No results yet
Run your code to test it against the sample cases.
Problem List