Back
Close

min+max

Statement

 Goal

You must sum the maximum and minimum of a sequence
Input
Line 1: Number of integers N
Line 2: A sequence of integers X with length N
Output
Line 1: The Sum of the Min and the Max of the sequence.
Constraints
2 ≤ N ≤ 1000
Example
Input
2
1 1
Output
2

Game modes
Shortest, Reverse

Test cases
Test 1 Test
Input
2 1 1
Output
2

Validator 1 Validator
Input
13 1 1 1 1 1 1 1 1 1 1 1 1 1
Output
2

Test 2 Test
Input
7 6 4 8 31 7 5 9
Output
35

Validator 2 Validator
Input
7 2 7 4 9 1 7 3
Output
10

Test 3 Test
Input
2 1 2
Output
3

Validator 3 Validator
Input
2 1 0
Output
1

Test 4 Test
Input
4 40 51 72 8
Output
80

Validator 4 Validator
Input
5 39 40 40 40 41
Output
80

Test 5 Test
Input
9 33 30 31 22 4 45 46 67 66
Output
71

Validator 5 Validator
Input
8 3 8 4 9 2 8 5 0
Output
9

Solution language

Solution

Stub generator input