You are viewing a single comment's thread. Return to all comments →
if name == 'main': n = int(input()) arr = map(int, input().split())
max_num = float('-inf') second_max = float('-inf') for i in arr: if i > max_num: second_max = max_num max_num = i
elif (i > second_max and i != max_num): second_max = i
print(second_max)
Seems like cookies are disabled on this browser, please enable them to open this website
Find the Runner-Up Score!
You are viewing a single comment's thread. Return to all comments →
if name == 'main': n = int(input()) arr = map(int, input().split())
max_num = float('-inf') second_max = float('-inf') for i in arr: if i > max_num: second_max = max_num max_num = i
print(second_max)