Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

The solution is to store accumulated sums into a state vector. But is that really dynamic programming or there is some other solution?

I think the way to computer the sum vector is the simplest dynamic programming example.

sum[i] = sum[i-1] + nums[i];

Since you don't sum all the numbers from nums[0] to nums[i].

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.