Leetcode 1480. Running Sum of 1d Array
1 2 3 4 5 6 7 8 9 10 11 12 | /** * @param {number[]} nums * @return {number[]} */ var runningSum = function(nums) { let result = [] result[0] = nums[0] for (i = 1; i < nums.length; i++) { result.push(result[i - 1] + nums[i]) } return result }; | cs |