문제
![](https://velog.velcdn.com/images%2Fcosmos%2Fpost%2F56099fe9-ba0b-41b6-be48-6b51c437c79a%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-08-09%20%E1%84%8B%E1%85%A9%E1%84%8C%E1%85%A5%E1%86%AB%2010.46.29.png)
풀이
- Given the participants' score sheet for your University Sports Day, you are required to find the runner-up score. You are given scores. Store them in a list and find the score of the runner-up.
- Given list is [2,3,6,6,5]. The maximum score is 6, second maximum is 5. Hence, we print 5 as the runner-up score.
코드
def solve(arr):
return sorted(set(arr))[-2]
if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().split()))
print(solve(arr))
결과
![](https://velog.velcdn.com/images%2Fcosmos%2Fpost%2Fd9c561cf-247e-42c5-a96c-10bcf66ebac6%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202021-08-09%20%E1%84%8B%E1%85%A9%E1%84%8C%E1%85%A5%E1%86%AB%2010.52.46.png)
출처 && 깃허브
hackerrank
github