JavaScript reduce solution
every time increase by (max - cur)\n\nvar minOperations = function(nums) {\n    var max = 0;\n    return nums.reduce((acc, cur) => { \n        max = Math.max(cu
every time increase by (max - cur)\n```\nvar minOperations = function(nums) {\n    var max = 0;\n    return nums.reduce((acc, cur) => { \n        max = Math.max(cur, ++max);\n        return acc + max - cur;\n    }, 0)\n};\n```
['JavaScript']