Second place
Level A. Teaches ?Int, max= and ??.
You are given n scores (1 ≤ n ≤ 2·10⁵, each from 1 to 10⁹). Print the largest score that is strictly below the maximum, or -1 if every score is the same.
Input: n, then n integers. Output: one integer.
| Input | Output |
|---|---|
53 1 4 1 5 | 4 |
6 tests · Ctrl+Enter