Java&Javascript Solution (JW)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\nJava:\n```\npublic int minOperations(int[] nums) {\n    int cnt = 0, prev = 0;\n    for (int cur : nums) {\n        if (cur <= prev) {\n            cnt += ++prev - cur;\n        } else {\n            prev = cur;\n        }\n    }\n    return cnt;\n}\n```\nJavascript:\n```\n/**\n * @param {number[]} nums\n * @return {number}\n */\nvar minOperations = function(nums) {\n    let cnt = 0, prev = 0;\n    for (let cur of nums) {\n        if (cur <= prev) {\n            cnt += ++prev - cur;\n        } else {\n            prev = cur;\n        }\n    }\n    return cnt; \n};\n```
['Java', 'JavaScript']