Skip to content

Heaps

Problem Complexity Key Pattern
Kth Largest --- Streaming top-K — "kth largest in a stream", "maintain running top K".
Merge K Sorted Lists O(n log k) where n = total nodes across all lists K-way merge for external sorting — "merge K sorted lists/arrays/files",
Task Scheduler O(t) where t = total intervals (bounded by len(tasks) * (n+1)) Scheduling with cooldown constraints — "minimum time to complete all