Kth Largest Element in an Array
MediumLeetCodeHeap / Priority Queue
Approach hintTry it first, then revealHide
Maintain a min-heap of the k largest values seen so far, so its top is the answer after O(n log k) work. Quickselect is an expected O(n) alternative.