# Find Median from Data Stream (LC5414) ## Problem Design a structure that supports addNum and findMedian in a growing stream. ## Approach Two heaps: max-heap for lower half, min-heap for upper half. Rebalance so sizes differ by at most 1. Median is top of larger heap or average of both tops. ## Complexity O(log n) add, O(1) median. ## Practice Heap design questions show up constantly — warm up with [real-time interview help](https://www.linkjob.ai/). ## Notes - Keep invariant explicit - Integer vs float median - Empty stream guard
Note.ms
/ljb5b313