dsa2 min read
K Closest Points to Origin
Find K points closest to the origin using a max-heap of size K or quickselect for O(n) average.
Read →
webcoderspeed.com
1276 articles
Find K points closest to the origin using a max-heap of size K or quickselect for O(n) average.
Find minimum CPU intervals to schedule tasks with cooldown using a greedy max-heap simulation.
Rearrange a string so no two adjacent characters are the same using a greedy max-heap approach.
Maintain a dynamic median using two heaps: a max-heap for the lower half and a min-heap for the upper half.
Compute medians of all sliding windows using two heaps with lazy deletion for element removal.