I am not able to figure out this approach .maxm subarray sum 2

i am not able to figure out this approach .maxm subarray sum 2.

exactly which thing you don’t understand??

in this approach we do some precomputation
we pre compute the cummulative sum so that whenever we have a requirment to find sum in a range l to r we can figure out in O(1) use the relation cum_sum[r] - cum_sum[l-1]

this is the only difference in this approach as compared to previous one
it is optimised version the previous solution

i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved
if you have more doubts regarding this feel free to ask

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.