Back to DSA sheet

Find Median from Data Stream

HardHeaps
Open on LeetCodeAmazonGoogleMeta

Design a structure that adds numbers from a stream and can return the median of all numbers so far.

Constraints
  • -10^5 <= num <= 10^5
  • Up to 5 * 10^4 calls
Sheets
Blind 75NeetCode 150NeetCode 250
find-median-from-data-stream.cpp
Loading editor
Custom input (stdin)
Output

Run your code to see its output.