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

Source


    vector<int> runningSum(vector<int>& nums) {
        vector<int> viAns;
        int sum = 0;
        for(int i=0; i<nums.size(); ++i){
            sum += nums[i];
            viAns.push_back(sum);
        }
        return viAns;
    }

GitHub