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.
Find the Runner-Up Score!
Find the Runner-Up Score!
+ 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 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 comments print(sorted(set(arr), reverse=True)[1])
+ 0 comments if name == 'main': n = int(input()) arr = list(set(map(int, input().split()))) arr.sort() print(arr[-2])
+ 0 comments if __name__ == '__main__': n = int(input()) arr = map(int, input().split()) listA = list(set(arr)) listA.sort() print(listA[-2])
Load more conversations
Sort 6710 Discussions, By:
Please Login in order to post a comment