ALG-E011EasyPrefix Sum
Running Energy Total
Return an array where each position contains the sum of all readings up to and including that position.
Contract
input numbers: integer[]
return integer[]
Examples
Example 1
numbers = [1, 2, 3]
→ [1, 3, 6]
Example 2
numbers = [-1, 5, -2]
→ [-1, 4, 2]
5 judge tests (2 shown above). Target complexity: O(n).