Problem 3507 · Easy

Minimum Pair Removal to Sort Array I

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

Open the interactive visualisation