Loading...
Loading...
Loading...
A contest has many scores, possibly repeated. Print the k-th largest score, counting repeated scores separately (the largest is first).
Example 1
Input
3 2 1 5 6 4 2
Output
5
Example 2
Input
3 2 3 1 2 4 5 5 6 4
Output
4
Try the problem first. Open one hint at a time.
You do not need to sort everything. Quickselect keeps only one side.
The k-th largest is the (n - k)-th smallest, counting from 0.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor