K-th Smallest Element

Medium · rating 1300 · Heap, Sorting

The first line has n and k. The second line has n integers. Print the k-th smallest value (1-indexed; duplicates count).

Constraints: 1 ≤ k ≤ n ≤ 105

Related problems

Open K-th Smallest Element in Code Arena →