1480. Running Sum of 1d Array

LJM·2023년 1월 3일
0

LeetCode

목록 보기
6/10

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

class Solution {
    public int[] runningSum(int[] nums) {
        
        int total = 0;
        int temp = 0;
        for(int i = 0; i < nums.length; ++i)
        {
            temp = nums[i];
            nums[i] += total;
            total += temp;
        }
        return nums;
        
    }
}
profile
게임개발자 백엔드개발자

0개의 댓글