I wonder if there is a better way of generating a better performing solution for partial sums of an array.
Given an array say
x = [ 0, 1, 2, 3, 4, 5 ], I generated sub-arrays of the items, and then computed the sum of each array which gives:
[ 0, 1, 3, 6, 10, 15 ]
So the full code is:
I wonder if flat map or some other array method will have a solution that does not require expanding each subarray.