You are given an integer array nums.
In one operation, you perform the following steps:
Locate the pair of adjacent elements with the minimum sum. If multiple adjacent pairs share the same minimum sum, choose the leftmost pair.
Replace the two elements in that pair with a single element equal to their sum.
Return the minimum number of operations required to make nums sorted in nondecreasing order.
Constraints:
nums.length
nums[i]
You are given an integer array nums.
In one operation, you perform the following steps:
Locate the pair of adjacent elements with the minimum sum. If multiple adjacent pairs share the same minimum sum, choose the leftmost pair.
Replace the two elements in that pair with a single element equal to their sum.
Return the minimum number of operations required to make nums sorted in nondecreasing order.
Constraints:
nums.length
nums[i]