Pregunta de entrevista de BT Group

Find the k-th largest element in an array

Respuesta de la entrevista

Anónimo

13 nov 2024

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.