Find the Runner-Up Score!

  • + 1 comment

    I did not understand your code, can you put it to me in simple terms? also can you tell me why this code fails? (7 test cases failed)

    n = int(input())
    arr = map(int, input().split())
    first_max, second_max = 0,0
    for current in arr :
        if current > first_max :
            first_max, second_max = current, first_max
        elif current > second_max :
            current = second_max   
    print(second_max)