c++ || using loop || easy approach
\n# Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(1)\n\n# Code\n\nclass Solution {\npublic:\n    int minOperations(vector<int>& nums) \n    {\n
\n# Complexity\n- Time complexity:\nO(N)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int minOperations(vector<int>& nums) \n    {\n        int count =0;\n        for(int i=0;i<nums.size()-1;i++)\n        {\n            if(nums[i] < nums[i+1])\n            {\n                continue;\n            }\n            else\n            {\n                \n                count = count +(nums[i] + 1-nums[i+1]);\n                nums[i+1]=nums[i]+1;\n\n            }\n        }return count;\n    }\n};\n```
['C++']