MinStack, MaxStack and Streaming Median

Asked at ByteDance · Coding Questions · Difficulty: Hard · Last asked Jan 30, 2026

Three linked structures in one MLE round: `MinStack` with O(1) min, `MaxStack`, and a streaming-median follow-up (two heaps), then how to retrofit MaxStack to maintain running median.

Loading the problem…