Google·Software Engineer·Onsite - System Design / Architecture
- The classic two-heap approach for streaming medians runs out of memory on a very large or unbounded stream. Walk through where the bottlenecks are and how you'd redesign the system to keep producing medians, either exact or approximate, under tight memory constraints.
“I started confidently with the two-heap setup and then kind of froze when they said 'now assume memory is the constraint.' My first instinct was to throw a quantile sketch at it and call it a day, but they pushed back immediately on accuracy guarantees.”