Skip to content
Onsite

Running Sum of 1d Array

EasyP3Coding

Return an array out of the same length as nums where out[i] is the sum of nums[0] .. nums[i].

Example 1

Input
nums = [1,2,3,4]
Output
[1,3,6,10]

Example 2

Input
nums = [1,1,1,1,1]
Output
[1,2,3,4,5]

Example 3

Input
nums = []
Output
[]

Constraints

  • 0 <= nums.length <= 10^5
  • -10^6 <= nums[i] <= 10^6

Hints

Run checks the 3 visible tests, Submit all 10.