Java || Easy Fastest Solution || 0ms
\n  int res=0;\n        if(nums.length==1){\n            return res;\n        }\n        int val=0;\n     for(int i=1;i<nums.length;i++){\n        \n         if
```\n  int res=0;\n        if(nums.length==1){\n            return res;\n        }\n        int val=0;\n     for(int i=1;i<nums.length;i++){\n        \n         if(nums[i-1]>=nums[i]){\n             val+=(nums[i-1]- nums[i])+1;\n             nums[i]=1+nums[i-1];\n         }\n     }\n        return val;\n```
['Greedy', 'Java']