Rust || O(n) || 0ms
Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(1)\n\n# Code\n\nimpl Solution {\n    pub fn min_operations(mut nums: Vec<i32>) -> i32 {\n        le
# Complexity\n- Time complexity: $$O(n)$$\n\n- Space complexity: $$O(1)$$\n\n# Code\n```\nimpl Solution {\n    pub fn min_operations(mut nums: Vec<i32>) -> i32 {\n        let mut ans = 0;\n        for i in 1..nums.len() {\n            if nums[i] <= nums[i-1] {\n                let change = nums[i-1] - nums[i] + 1;\n                ans += change;\n                nums[i] += change;\n            }\n        }\n        ans\n    }\n}\n```
['Rust']