HeapEvidence Contributing
Heap for Top-K / Kth Element
Maintain a fixed-size heap to track the k largest/smallest/most-frequent elements seen so far.
Practice Problems: 12
Difficulty: 2 Easy·7 Medium·3 Hard
Core technique
Review the technique, then try the mapped problems below. The right approach depends on each problem's constraints.
- Core Strategy: Maintain a fixed-size heap to track the k largest/smallest/most-frequent elements seen so far.