Open AIRSATM opened 1 month ago
class Solution { public: vector runningSum(vector& nums) { for(int i=1; i<nums.size(); i++){ // we started with 1st index, so 0 index is not reading nums[i] += nums[i-1]; } return nums; } }; //next we know how write a code in int main ^3^
class Solution { public: vector runningSum(vector& nums) {
for(int i=1; i<nums.size(); i++){ // we started with 1st index, so 0 index is not reading
nums[i] += nums[i-1];
}
return nums;
}
}; //next we know how write a code in int main ^3^