changes records how much the balance moved on each day: a positive number is a deposit, a negative one is a withdrawal.
Return an array of the same length whose i-th element is the balance at the end of day i, that is, changes[0] + changes[1] + … + changes[i].changes=[500, -200, 300, -1000] → [500, 300, 600, -400]
The balance after each day: 500, 500 − 200 = 300, 300 + 300 = 600, 600 − 1000 = −400.
changes=[0, 0, 7] → [0, 0, 7]
Two quiet days, then 7 comes in on the third.
changes=[-3] → [-3]
With a single day the answer is just that change.
changes.length ≤ 10^5changes[i] ≤ 10^6changes=[500, -200, 300, -1000]
[500, 300, 600, -400]
Run checks the first 3 tests in your browser. Submit checks all 91 tests on the server, hidden ones included.