The cumulative sum of an array at index i is defined as the sum of all elements of the array from index 0 to index i.
Initial Array: [1, -2, 3, 4, -6]
Cumulative Sum: [1, -1, 2, 6, 0]
Initial Array: [1, -1, -1, -1, 1]
Cumulative Sum: [1, 0, -1, -2, -1]
Initial Array: [1, 3, 5, 7]
Cumulative Sum: [1, 4, 9, 16]
The positive cumulative sum of an array is a list of only those cumulative sums which are positive.
Initial Array: [1, -2, 3, 4, -6]
Cumulative Sum: [1, -1, 2, 6, 0]
Positive Cumulative Sum: [1, 2, 6]
Initial Array: [1, -1, -1, -1, 1]
Cumulative Sum: [1, 0, -1, -2, -1]
Positive Cumulative Sum: [1]
Initial Array: [1, 3, 5, 7]
Cumulative Sum: [1, 4, 9, 16]
Positive Cumulative Sum: [1, 4, 9, 16]
Given an array, return its positive cumulative sum.
The first line contains 'T' denoting the no. of test cases.
Next T lines each contain a number 'n' denoting the number of elements, followed by n space-separated numbers denoting the array elements.
T lines each contain all the positive cumulative sum for that test case.
3
5 1 -2 3 4 -6
5 1 -1 -1 -1 1
4 1 3 5 7
1 2 6
1
1 4 9 16
0 <= T <= 1000
1 <= N <= 10000
-104 <= array element <= 104