[C++] One pass solution (100% time & 100% space)
\nclass Solution {\npublic:\n    int minOperations(vector<int>& nums) {\n        int result = 0;\n        \n        for (int i = 1; i < nums.size(); ++i) {\n   
```\nclass Solution {\npublic:\n    int minOperations(vector<int>& nums) {\n        int result = 0;\n        \n        for (int i = 1; i < nums.size(); ++i) {\n            if (nums[i] <= nums[i - 1]) {\n                result += nums[i - 1] + 1 - nums[i];\n                nums[i] = nums[i - 1] + 1;\n            }\n        }\n        \n        return result;\n    }\n```
[]