All Posts

1276 articles

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 →
dsa2 min read

Task Scheduler

Find minimum CPU intervals to schedule tasks with cooldown using a greedy max-heap simulation.

Read →
dsa3 min read

Reorganize String

Rearrange a string so no two adjacent characters are the same using a greedy max-heap approach.

Read →
dsa2 min read

Find Median from Data Stream

Maintain a dynamic median using two heaps: a max-heap for the lower half and a min-heap for the upper half.

Read →
dsa3 min read

Sliding Window Median

Compute medians of all sliding windows using two heaps with lazy deletion for element removal.

Read →
Page 68 of 256