Easiest Java Solution [ 100% ] [ 2ms ]
Approach\n1. Initialization:\n   - Get the length of the array nums and store it in len.\n   - Create a new array arr of the same length as nums.\n   - Initiali
# Approach\n1. **Initialization**:\n   - Get the length of the array `nums` and store it in `len`.\n   - Create a new array `arr` of the same length as `nums`.\n   - Initialize a variable `count` to keep track of the total number of operations.\n\n2. **Copying the Original Array**:\n   - Copy each element of `nums` into `arr` to work with a separate array that will be modified.\n\n3. **Ensure Strictly Increasing Order**:\n   - Iterate through the `arr` from the first element to the second-to-last element.\n   - For each element, check if the next element (`arr[i+1]`) is less than or equal to the current element (`arr[i]`).\n   - If this condition is true, update the next element (`arr[i+1]`) to be one more than the current element (`arr[i] + 1`).\n\n4. **Calculate the Total Number of Operations**:\n   - Iterate through the `arr` and calculate the difference between each element of `arr` and the corresponding element in `nums`.\n   - Add this difference to `count`.\n\n5. **Return the Result**:\n   - The `count` now contains the total number of operations needed to make `nums` strictly increasing.\n   - Return `count`.\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(n)\n\n# Code\n```\nclass Solution {\n    public int minOperations(int[] nums) {\n        int len=nums.length;\n        int arr[]=new int[len];\n        int count=0;\n        for(int i=0; i<len; i++){\n            arr[i] = nums[i];\n        }\n        for(int i=0; i<len-1; i++){\n            if(arr[i+1] <= arr[i]){\n                arr[i+1] = arr[i]+1;\n            }\n        }\n        for(int i=0; i<len; i++){\n            count+=arr[i]-nums[i];\n        }\n        return count;\n    }\n}\n```\n\n![193730892e8675ebafc11519f6174bee5c4a5ab0.jpeg](https://assets.leetcode.com/users/images/9873d175-0860-4556-af72-3f98358f00f0_1718694477.621999.jpeg)\n
['Java']