This page uses the site's newer layout, so only the problem statement and the section outline survive in the public payload — open the original for the rest.
Heap
Find Median from Data Stream
hard
DESCRIPTION (inspired by Leetcode.com)
A live analytics dashboard starts with nums. New readings arrive in order in adds. After each incoming value is inserted, return the current median of all readings seen so far. If the count is even, the median is the average of the two middle values.
Example 1:
Inputs:
nums = [5, 2, 8]
adds = [3, 10, 4]
Output:
[4, 5, 4.5]