Problem 2336 · Medium

Smallest Number in Infinite Set

Hand out numbers in order from a counter, and let added-back numbers jump the queue through a min heap.

Open the interactive visualisation