100% 1ms Java Solution
Using num as the latest value to compare with next nums[i], instead of increasing nums[i] and using it to compare with nums[i+1]. Changing the value of nums[i] 
Using num as the latest value to compare with next nums[i], instead of increasing nums[i] and using it to compare with nums[i+1]. Changing the value of nums[i] costs more time than changing the value of the variable num. \n\n```\nclass Solution {\n    public int minOperations(int[] nums) {\n        if (nums.length <= 1) {\n            return 0;\n        }\n\n        int count = 0;\n        int num = nums[0];\n        for (int i = 1; i < nums.length; i++) {\n            if (num == nums[i]) {\n                count++;\n                num++;\n            } else if (num > nums[i]) {\n                num++;\n                count += num - nums[i];\n            } else {\n                num = nums[i];\n            }\n        }\n        \n        return count;\n    }\n}\n```
['Java']