• + 1 comment

    It's a cumulative sum. Add each element in the array sequentially and store the maximum value of the sum as you iterate through.

    Starting at index 0, your max sum is 3. Once you hit index 4, max sum is now 10. This is the max that it ever reaches, as it becomes 8 at index 6, 1 at index 9, and 0 at index 10.