Median of Data Stream

Given a stream of numbers, find the median number at any given time (accurate to 1 decimal place).

Example:

1add_number(1)
2add_number(2)
3add_number(3)
4get_median() == 2.0
5add_number(4)
6get_median() == 2.5

Try it yourself

Invest in Yourself

Your new job is waiting. 83% of people that complete the program get a job offer. Unlock unlimited access to all content and features.

Go Pro