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.
#First do list of all of elements
arr = list(arr)
arr.sort()
#print(arr)
#remove duplicates
uniuque_elements = set(arr)
#print(uniuque_elements)
#find the second hight score number
max_value = max(uniuque_elements)
uniuque_elements.remove(max_value)
#print(uniuque_elements)
Something I got confused about while working on this problem was actually understanding what the term "runner-up score" means. This was a bit confusing for me. The second thing I wasn't sure about was how to create a list for the "arr." However, in the end, I understood that we do need to have a list. But did we convert the "arr" to a list?
print(max(uniuque_elements))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Find the Runner-Up Score!
You are viewing a single comment's thread. Return to all comments →
#find the second hight score number #print it out
Something I got confused about while working on this problem was actually understanding what the term "runner-up score" means. This was a bit confusing for me. The second thing I wasn't sure about was how to create a list for the "arr." However, in the end, I understood that we do need to have a list. But did we convert the "arr" to a list?