Two Pointers
295. Find Median from Data Stream
Maintain the median of a growing stream — addNum inserts, findMedian reports the current middle. Re-sorting on every query is hopeless at scale, and even inserting into a sorted array is O(n) per…
Loading…