Find Median from Data Stream · Compound Engineer

Find Median from Data Stream

Keep the median of a growing stream available in O(1). Split the numbers into a lower half in a max-heap and an upper half in a min-heap, and the median is always sitting on the tops.

DSAProHardStep-through playerBy Aayush OstwalSolve on LeetCode ↗
Spotted a mistake in this lesson?Report an issue →