Find the Runner-Up Score!

Sort by

recency

|

8113 Discussions

|

  • + 0 comments

    h= float('-inf') for i in arr: if i >h : sh =h h=i elif(i>sh and h!=i): sh=i print(sh)

  • + 0 comments

    This is much better

    if __name__ == '__main__':
        n = int(input())
        arr = set(map(int, input().split()))
        arr.remove(max(arr))
        print(max(arr))
    
  • + 0 comments
    f __name__ == '__main__':
        n = int(input())
        arr = map(int, input().split())
        arr = list(set(arr))
        arr.sort(reverse=True)
        print(arr[1])
    
  • + 1 comment

    if name == 'main': n = int(input()) arr = list(map(int, input().split()))

    a=max(arr)
    c=arr.count(a)
    
    for i in range(c):
        arr.remove(a)
    
    print(max(arr))
    
  • + 0 comments

    if name == 'main': n = int(input()) arr = map(int, input().split()) score = list(arr) winner = max(score) runnerup = max([x for x in score if x!=winner]) print(runnerup)