Maximum subarray sum

i didn’t understand the cumulative sum approach of the above question can you explain me more clearly

hello @aasif2364

the idea is simple, cumulative[i] stores sum from index 0 to index i.

now if u want to find sum from index j to index i
then we need to find sum till index i and then we have to subtract sum till j-1 .
thats why
sum between j…i= cumulative [i]- cumulative [j-1]

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.