Search across blog, articles, projects, courses, and community posts
Print the second largest distinct value in a list. If the maximum appears several times, it still counts once.
Input:
n, the number of values.n integers.Output: the second largest distinct value.
2 <= n <= 1000, values between -10^9 and 10^9. The list always contains at least two distinct values.
5 3 1 4 1 5
4
4 7 7 5 5
5