Which optimized heap pattern solves this lesson cleanly?
Practice this question from Kth Largest Element - Size-K Min-Heap Pattern Practice Quiz, with options and an explanation.
Question
Which optimized heap pattern solves this lesson cleanly?
Option A — Correct answer
Size-k min-heap that keeps only the k largest values.
Option B
Plain nested loops without ordering
Option C
Hash set lookup only
Option D
Binary search on unsorted input
Explanation
Size-k min-heap that keeps only the k largest values.