Second Largest Value
Print the second largest distinct value of the list. If all values are equal, print NONE.
Input: the first line has an integer N; the second line has N integers separated by spaces.
Output: the second largest distinct value, or NONE.
Constraints:
- 1 ≤ N ≤ 2000
- −109 ≤ ai ≤ 109
Sample Tests
Input 1
5 3 9 4 9 2
Output 1
4
Input 2
3 5 5 5
Output 2
NONE
Discussion (opens after you solve — no spoilers before)
No comments yet.