C++ Track Last
cpp\nint minOperations(vector<int>& nums) {\n    int res = 0, last = 0;\n    for (auto n : nums) {\n        res += max(0, last - n + 1);\n        last = max(n, 
```cpp\nint minOperations(vector<int>& nums) {\n    int res = 0, last = 0;\n    for (auto n : nums) {\n        res += max(0, last - n + 1);\n        last = max(n, last + 1);\n    }\n    return res;\n}\n```
[]