python | beats 99.8% | easy
\nclass Solution:\n    def minOperations(self, nums: List[int]) -> int:\n        \n        \n        pre,ans=0,0\n        \n        for i in nums:\n            
```\nclass Solution:\n    def minOperations(self, nums: List[int]) -> int:\n        \n        \n        pre,ans=0,0\n        \n        for i in nums:\n            if pre < i:\n                pre=i\n            else:\n                pre+=1\n                ans+=pre-i\n        return ans\n```
['Python', 'Python3']