762. Running Sum of the Array
0
Easy
Given an array nums of length n. We define a running sum of an array as for every index runningSum[i] = sum(nums[0]…nums[i]).
Return the running sum of array for each i (0 <= i < n).
Input Format
First line contains an integer n representing number of elements.
Next line contains n integers denoting array elements.
Output Format
An integer representing running sum array of the given array
Example
Input
4
1 2 3 4
Output
1 3 6 10
Constraints
1 <= nums.length <= 1000
-10^6 <= nums[i] <= 10^6
-10^6 <= nums[i] <= 10^6
Loading...
View Submissions
Console