Practice · 2 of 5
Second Maximum
CHALLENGE
Difficulty: intermediate+25 XP
**Description:** Print the second largest **distinct** value in an array.
**Input:** Line 1: n (2 ≤ n ≤ 10^5). Line 2: n numbers (−10^9 ≤ each ≤ 10^9).
**Output:** One integer, or NONE if all values are equal.
**Example:** 4 / 3 7 7 5 → 5 (7 is largest; 5 is second distinct).
Press Submit to check your solution.
Back to lesson: Practice: Array Mechanics Set