Skip to content
Programming101
Programmingoneonone
  • Home
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programming101
Programmingoneonone

HackerRank Find the Runner Up Score solution in python

YASH PAL, 31 July 2024

In this HackerRank Find the Runner Up Score problem solution Given the participants’ score sheet for your University Sports Day, you are required to find the runner-up score. You are given n scores. Store them in a list and find the score of the runner-up.

Problem solution in Python 2 programming.

# Enter your code here. Read input from STDIN. Print output to STDOUT


def max(l):
    return sorted(set(l))[-2]

test = int(raw_input())
l = [int(_) for _ in raw_input().split()]
print max(l)


Problem solution in Python 3 programming.

if __name__ == '__main__':
    n = int(input())
    arr = map(int, input().split())
    arr = list(arr)
    x = max(arr)
    y = -9999999
    for i in range(0,n):
        if arr[i]<x and arr[i] > y:
            y = arr[i]
    
    print(y)

Problem solution in pypy programming.

if __name__ == '__main__':
    n = int(raw_input())
    arr = map(int, raw_input().split())
    Max = max(arr)
    while max(arr) == Max:
        arr.remove(max(arr))
    print max(arr)

Problem solution in pypy3 programming.

if __name__ == '__main__':
    n = int(input()) 
    #print (input().split())
    #arr = [int(x) for x in input().split()]
    #print (list(input()))
    arr = list(map(int, input().split()))
    #print (arr)
    #arr = sorted(arr)
    arr.sort()
    #print (arr)
    for i in range(n-1, -1, -1):
        if arr[i]<arr[n-1]:
            temp = arr[i]
            break
    print (temp)
    #sorted(arr)
    #print (arr[n-1])
           

coding problems solutions Hackerrank Problems Solutions Python Solutions

Post navigation

Previous post
Next post

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2025 Programmingoneonone | WordPress Theme by SuperbThemes