Running Sum
Easy
LC #1480
arrayprefix sumNot attempted yet
Given a list of integers nums, return a new list
where position i holds nums[0] + nums[1] + … + nums[i].
Example 1
Input: nums = [1, 2, 3, 4]
Output: [1, 3, 6, 10]
Example 2
Input: nums = [2, 2, 2]
Output: [2, 4, 6]
Example 3
Input: nums = [5, -1, 0, 3]
Output: [5, 4, 4, 7]
Constraints
- 0 ≤ nums.length ≤ 10⁵
- -10⁴ ≤ nums[i] ≤ 10⁴