Skip to main content
Admissions guidance, study banks, and career tools โ€” get started on Shalyam

Find Median from Data Stream

Design a structure supporting add x and median. Print the median (with one decimal place) for every median operation.

Constraints

1 <= q <= 5 * 10^4 -10^5 <= x <= 10^5 median is only called when at least one number was added

Discussion

No discussions yet.

Rewards ยท v2.1

Join Shalyam Newsletter

Get exclusive insights with every issue: education, research and innovation news.

One email a week. Unsubscribe any time.