Problem 3510 · Hard

Minimum Pair Removal to Sort Array II

Repeatedly merge the adjacent pair with the smallest sum, leftmost on ties, until the array never decreases; count the merges.

Open the interactive visualisation