Problems > Running Median > Editorial

Running Median — Solution & Editorial

Back to the Problem

Two heaps: a max-heap for the lower half and a min-heap for the upper half, rebalanced so the lower half holds the extra element; its top is the lower median.

Complexity: O(N log N)