1class Solution {
2 public int[] runningSum(int[] nums) {
3 int[] sol = new int[nums.length];
4 sol[0] = nums[0];
5 for(int i = 1; i < nums.length; i++) {
6 sol[i] = sol[i-1] + nums[i];
7 }
8 return sol;
9 }
10}
11
12// Example: runningSum([1,3,6,9]) = [1, 4, 10, 19] = [1, 1+3, 1+3+6, 1+3+6+9]