SW/leetcode-75 Study Plan

[Day1 - 1] 1480. Running Sum of 1d Array

실행컨텍스트 2022. 8. 18. 22:47
728x90

https://leetcode.com/study-plan/leetcode-75/

 

LeetCode 75 - Study Plan - LeetCode

This study plan is for those who want to prepare for technical interviews but are uncertain which problems they should focus on. The problems have been carefully curated so that levels 1 and 2 will guide beginner and intermediate users through problems tha

leetcode.com

https://leetcode.com/problems/running-sum-of-1d-array

var runningSum = function(nums) {
    let answer = [];
    answer.push(nums[0]);
    for(let i = 1; i<nums.length; i++ ){
        answer.push(answer[i-1] + nums[i]);
    }
    return answer
};

728x90