Coding

Find the median from a continuous data stream.

Implement a data structure that allows you to add integers from a continuous data stream and find the median of all elements so far efficiently.

Input: addNum(2), addNum(3), findMedian(), addNum(4), findMedian()

Output: 2.5 then 3.0

Explanation: After adding 2 and 3, the median is 2.5. After adding 4, the sorted stream is [2, 3, 4], making the median 3.0.

Was asked at

Practice this question with AI

First session is free - no credit card required.

Go Premium

More interviews, more skills, more success.

No answers yet

Be the first to share your approach to this question

Practice More Questions

1 answer published. Last candidate submission on Jul 26 2026, 2:47am PDT. Interview question asked to Software Engineers interviewing at Qlik, Twitter, Two Sigma and other companies. Original question asked: Find the median from a continuous data stream.. Question last reported by a candidate interviewing at Checkout for a Software Engineer interview on Oct 25 2026, 1:19pm PDT.