Find Median from Data Stream

Hard

📝 Description

Design class to find median of numbers from data stream

Input Format

Series of addNum() and findMedian() operations

Output Format

Median after each findMedian()

Constraints

At most 5 * 10^4 calls

🔍 Sample Input

add(1), add(2), find(), add(3), find()
            

✅ Sample Output

1.5, 2.0
            

Code Editor

Please login to run and submit code.

Shortcuts: Ctrl+Enter to submit, Ctrl+Shift+R to run