80% SPACE AND TIME BEATS || C++ || EASY || SIMPLE
\nclass Solution {\npublic:\n    int minOperations(vector<int>& nums) {\n        int ans = 0;\n        for(int i = 1; i < nums.size(); i++){\n            if(num
```\nclass Solution {\npublic:\n    int minOperations(vector<int>& nums) {\n        int ans = 0;\n        for(int i = 1; i < nums.size(); i++){\n            if(nums[i]==nums[i-1]){\n                ans++;\n                nums[i]++;\n            }\n            else if(nums[i]-nums[i-1]<0){\n                ans += -nums[i]+nums[i-1]+1;\n                nums[i] = nums[i-1]+1;\n            }\n        }\n        // for(auto &i: nums)cout<<i<<" ";\n        return ans;\n    }\n};\n```
['Greedy', 'C', 'C++']