Find the Runner-Up Score!

Sort by

recency

|

8366 Discussions

|

  • + 0 comments
    unique_scores = sorted(list(set(arr)), reverse=True)
        print(unique_scores[1])
    
  • + 0 comments

    print((sorted(list(set(arr))))[-2])

  • + 0 comments
    n = int(input())
    scoreList = list(map(int,input().split(" ")))
    scoreList.sort()
    print(scoreList)
    if (n>=1 and n<=10): 
        if n <= 3:
            if n == 1:
                print(scoreList[0])
            elif n == 2:
                print(scoreList[0]) if scoreList[0] > scoreList[1] else print("Same Score")
            else:
                print(scoreList[0]) if (scoreList[0] == scoreList[1]) or (scoreList[1] == scoreList[2]) else print(scoreList[1])
        else:
            for i in range(len(scoreList)):
                if scoreList[n-i-1] != scoreList[n-i-2]:
                    print(scoreList[n-i-2])
                    break
                else:
                    pass
    else:
        pass
    
  • + 0 comments

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

    arr = sorted(set(arr))
    
    print(arr[-2])
    
  • + 0 comments

    Probably a bit of longer path:

    if __name__ == '__main__':
        n = int(input())
        arr = map(int, input().split())
        
        stored_list = list(arr)
        
        stored_list.sort(reverse=True)
        
        counter = 1
        for i in stored_list:
            if stored_list[counter]<i:
                print(stored_list[counter])
                break
            else:
                counter+=1