173. K-th Smallest Element
EasySortingSelection
Print the k-th smallest element (1-based, counting duplicates).
Input format
Line 1: n k Line 2: n integers
Output format
The k-th smallest.
Example 1
Input
6 3 7 10 4 3 20 15
Output
7
Example 2
Input
3 1 5 5 5
Output
5
Constraints
1 ≤ k ≤ n ≤ 10⁵
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…