We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Python
  3. Basic Data Types
  4. Find the Runner-Up Score!
  5. Discussions

Find the Runner-Up Score!

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 6710 Discussions, By:

recency

Please Login in order to post a comment

  • aswini0509
    19 hours ago+ 0 comments
    list1 = list(set(arr))
    
    list1.remove(max(list1))
    
    print(max(list1))
    
        with this solution all the test case where passed 
    

    one more way it can be solved list1 = list(set(arr)) print(list1[-2])

    0|
    Permalink
  • bandhiyapratik31
    21 hours ago+ 0 comments

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

    arr = list(set(arr))
    arr.remove(max(arr))       # you can use pop function too : )
    print(max(arr))
    
    0|
    Permalink
  • sunlexgroup
    2 days ago+ 0 comments

    print(sorted(set(arr), reverse=True)[1])

    0|
    Permalink
  • sang1729
    2 days ago+ 0 comments

    if name == 'main': n = int(input()) arr = list(set(map(int, input().split()))) arr.sort() print(arr[-2])

    0|
    Permalink
  • ebenj_van_rensb1
    2 days ago+ 0 comments
    if __name__ == '__main__':
        n = int(input())
        arr = map(int, input().split())
        listA = list(set(arr))
        listA.sort()
        print(listA[-2])
    
    0|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy