Maximum Sum Subarray

I can’t understand why in the optimised solution video (!4th video of array subsection) have we used

csum[i]+=csum[i-1]+a[i]

and not

csum[i]=csum[i-1]+a[i]

Timestamp-> 08:54

hi @anikapassi17_6ce74879d4a8438b it doestnt matter here as csum[i] is 0 initially, u can do both ways

you mean for i=0 csum[i]=0, but what about other values, I am still not able to understand clearly

@anikapassi17_6ce74879d4a8438b do a dry run on paper (you mean for i=0 csum[i]=0 yes)

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.