class Solution {
public int minOperations(int[] nums) {
int n = nums.length;
int res = 0;
for(int i = 1; i < n ; i++) {
if(nums[i] <= nums[i-1]) {
res += nums[i-1] + 1 - nums[i];
nums[i] = nums[i-1] + 1;
}
}
return res;
}
}
标签:nums,int,1827,最少,数组,递增
From: https://www.cnblogs.com/eiffelzero/p/16974109.html