Leetcode 295. Find Median from Data Stream
Maintain a data structure that supports adding integers from a stream and returning the current median efficiently for many interleaved addNum and findMedian calls. The core challenge is to keep the lower and upper halves balanced (e.g., two heaps) for fast updates and median retrieval, with follow-up optimizations using counting/frequency arrays when values lie in or mostly within a small fixed range.
Asked at:
Meta
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late January, 2025
Meta
Staff
Late November, 2024
Meta
Junior
Find the median of two sorted arrays using binary search
Your account is free and you can post anonymously if you choose.