Find the k-th largest element in an array
Anonimo
I explained and implemented the approach using a min-heap, where I first built a heap of size k with the first k elements and then replaced the smallest element in the heap with any larger element from the remaining array, ultimately finding the k-th largest element at the root of the heap.