Median of Data Stream

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

Example:

add_number(1)
add_number(2)
add_number(3)
get_median() == 2.0
add_number(4)
get_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