Cumilative sum of the element arr[-1]

As discussed in the video of array for finding maximum sum , using the cumilative sum method , the sum which is described in the nested for loop is as follows
sum=cum_sum[j]-cum_sum[i-1];
so , if the value of i is 0 , then cum_sum[-1] is not defined and it will return a garbage value , How to resolve this ?

@bongdev
hello Saurabh,
if i = 0 then sum = cum_sum[i] only , handle this case by putting if statement inside ur while loop

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.