Second Max

Find the second largest number in this file .

Note : The file contains 10000 space-separated integers . All of them fits in a 32-bit integer.


Current Winner : 展豪 張
Language : Python
Length : 43


This is a Code Golf challenge which focuses on achieving the shortest possible source code instead of its efficiency.
To participate, submit your program in any programming languages. Write the size of your program (do not ignore whitespaces) and programming language in the beginning of your solution and then attach your code. Add explanation if necessary.


The answer is 999782821.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

展豪 張
Jul 12, 2016

python (60) (this python file is in the same folder of the txt file, txt renamed)
(this is actually a quite long programme......)

1
2
f=open('a.txt')  
print(sorted(map(int,f.read().split()))[-2])  

EDIT: python (43) (assuming the texts are fed into the standard input)
(still quite long......)

1
print(sorted(map(int,input().split()))[-2])

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...