Skip to content

Commit

Permalink
added Running Sum of 1d Array problem
Browse files Browse the repository at this point in the history
  • Loading branch information
mukul96 authored Nov 14, 2022
1 parent 6313ff8 commit a85f2f5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Array/Running Sum of 1d Array.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Solution {
public:
vector<int> runningSum(vector<int>& nums) {
vector<int> res(nums.size(),0);
res[0] = nums[0];
for(int i=1;i<nums.size();i++){
res[i] = res[i-1] +nums[i];
}
return res;
}
};

0 comments on commit a85f2f5

Please sign in to comment.