#3510
Minimum Pair Removal to Sort Array II
master · 1735 · lc hard +32 · 39.2% accepted · 404 likes · top 18%
Description
You may repeatedly choose the leftmost pair of adjacent elements with the smallest sum in nums and replace them with their combined sum. Continue until the array becomes non-decreasing.
Return the minimum number of such operations needed.
Code
1
2
3