Skip to main content
Find Median from Data Stream | AlgoCracked
AlgoCracked
ProblemsFind Median from Data Stream
Hard51.0% acceptance
Blind75Two PointersDesignSortingHeap

Find Median from Data Stream

Design a structure that supports adding integers from a stream and querying the median of all values seen so far. addNum(num) inserts a value; findMedian() returns the median (the average of the two middle values when the count is even). MedianFinder() constructs it. Input format Operation names + parallel argument lists. findMedian returns a number (checked to within 1e-5).

Loading workspace…