369. Running Sum of an Array
0
Easy
Given an array nums of length n, the running sum of the array is defined as the sum of all elements from the beginning of the array up to the current index. Return the running sum of the given array.
Input Format
The input starts with an integer n, representing the number of elements in the array. The next line contains n integers, denoting the elements of the array.
Output Format
An integer representing the 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