Find the Runner-Up Score!

Sort by

recency

|

8529 Discussions

|

  • + 0 comments
    arr = list(set(arr))
    arr.sort()
    
    print(arr[-2])
    
  • + 0 comments

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

    unique_scores = list(set(arr))   # remove duplicates
    unique_scores.sort()             # sort ascending
    
    print(unique_scores[-2])         # second largest
    
  • + 0 comments

    if name == 'main':

        n = int(input())
    
        arr = list(map(int, input().split(' ')))
    
        if 2<=n<=10 and all(-100<=x<=100 for x in arr):
    
                scores = sorted(set(arr))
    
        print(scores[-2])
    
  • + 0 comments

    n = int(input()) l = map(int, input().split()) s=set(l) l2=list(s) l2.sort() l2.pop() print(l2.pop())

  • + 0 comments
     n = int(input())
    arr = list(map(int, input().split()))
    
    i: int = 0  # type hint, does not enforce type
    
    if(2<=n<=10 and -100<=arr[i]<=100):
    
     arr1=list(set(arr))  #deleting dupli n storing in list instead of set
    
     y=len(arr1)           #new len of arr
    
     for i in range(y):  #bubble sort
        for j in range(y-1-i):
            if arr1[j] > arr1[j+1]:
                temp=arr1[j]
                arr1[j]=arr1[j+1]
                arr1[j+1]=temp
    

    t=len(arr1) print(arr1[-2])