Find the Runner-Up Score!

Sort by

recency

|

8462 Discussions

|

  • + 0 comments

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

    min_val = -100
    max1 = min_val
    second_max=min_val
    
    for i in arr:
        if(i>max1):
            second_max=max1
            max1=i
        elif(i>second_max and i!=max1):
            second_max=i
    

    print(second_max)

  • + 0 comments
    if __name__ == '__main__':
        n = int(input())
        arr = map(int, input().split())
        arr = list(set(arr))
        arr.sort()
        print(arr[-2])
    

    maybe this is very simple answer in this problem yes

  • + 0 comments

    if name == 'main': n = int(input()) arr = map(int, input().split()) arr = list(set(arr)) arr.sort() print(arr[-2]) maybe this is very simple answer in this problem yes

  • + 0 comments
    arr = list(map(int, input().split()))  
    
    print(max([x for x in arr if x < max(arr)]))
    

    so that you know, if it was only arr = map(int, input().split()) it can only be used as a list once, then arr becomes an empty list

  • + 0 comments

    if name == 'main': n = int(input()) arr = list(map(int, input().split())) maximum =arr[0] runnerup = arr[0]

    for i in range(n):
            if arr[i]>= maximum:
                    maximum = arr[i]
    
            else:
                    runnerup = arr[i]
    
    
    for i in range(n):
            if arr[i]>runnerup and arr[i]!=maximum :
                    runnerup = arr[i]
    
    
    
    print(runnerup)