Problem 1046 · Easy

Last Stone Weight

Repeatedly smash the two heaviest stones together, keeping the difference, and report the final remaining weight. A max-heap shows the two heaviest stones at each step.

Open the interactive visualisation