Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
If you can increment only once, which number should you increment?
We should always prioritize the smallest number. What kind of data structure could we use?
Use a min heap to hold all the numbers. Each time we do an operation, replace the top of the heap x by x + 1.