Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 350 Bytes

TIPS.md

File metadata and controls

21 lines (15 loc) · 350 Bytes

Tips and Tricks

Calculate Prefix Sum

class Solution {
public:
    vector<int> runningSum(vector<int>& nums) {
        for (int i = 1; i < nums.size(); i++) {
            nums[i] += nums[i-1];
        }
        
        return nums;
    }
};