You are viewing a single comment's thread. Return to all comments →
gtorrecilla. What do you think of this? Its not the best by line count, but I believe it finds the 2nd largest within O(n).
max = max2 = -100 - int(raw_input()) nums = map(int,raw_input().split(' ')) for i in range(len(nums)): if nums[i] > max2: if nums[i] > max: max,max2 = nums[i],max elif nums[i] < max: max2 = nums[i] print(max2)
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 →
gtorrecilla. What do you think of this? Its not the best by line count, but I believe it finds the 2nd largest within O(n).