LeetCode 1827. Minimum Operations to Make the Array Increasing Posted on 2021-04-18 Edited on 2024-11-24 In LeetCode 12345678910111213141516class Solution {public: int minOperations(vector<int>& nums) { int ans = 0, prev = INT_MIN; for (int num : nums) { if (num <= prev) { int next = prev + 1; ans += next - num; prev = next; } else { prev = num; } } return ans; }};