What did you learn? For k-th largest, use a min-heap of size . For k-th smallest, use a max-heap of size .
The heap root is the "boundary" element. Anything smaller (for k-th largest) gets filtered out.
Bounded heaps reduce time complexity from to . This pattern extends to "top k elements," "k closest points," and similar problems.