public class Solution { public int[] RunningSum(int[] nums) { var accum = 0; var list = new List<int>(); foreach (var n in nums) { accum += n; list.Add(accum); } return list.ToArray(); } }Source: https://leetcode.com/problems/running-sum-of-1d-array/
No comments:
Post a Comment