Name the Runner-Up
Intermediate SolvedA leaderboard shows not just the winner but the runner-up. Given scores with possible ties at the top, return the second-largest distinct score.
Implement `solve(List<Integer> nums)` (at least two distinct values) to return the second-largest distinct value.
Examples
Input
[10, 5, 20, 20, 8]Output
10Input
[1, 2]Output
1Hints
- Track the largest and second-largest as you scan; skip duplicates of the max.
Tests
Your code runs in a secure sandbox against multiple hidden test cases. The problem is solved only when every test passes. Each run is isolated and any data changes are rolled back automatically.