In max sum array problem?

in the max sum array problem?
when I =0, then cumsum[i-1] will become cumsum[-1] how is this possible?

there is slight mistake in the video you need to add a if condition to make sure that cumulative_sum[-1] is not accessed
if(i == 0) cumsum[i] = a[i]
else cumsum[i] = a[i] + cumsum[i-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.

here its okay
but i am saying in the second for loop where its written
sum=cumsum[j] - cumsum[i-1] ??

yes we need to add the if condition wherever there is possibility of accessing -1

then what should we write after the if condition

if(i == 0)
cumsum[i] = a[i]

I am not saying here.
see in the nested for loop "sum=cumsum[j] - cumsum[i-1] " here what will we write

Yes instead of “sum=cumsum[j] - cumsum[i-1]” an if else condition would come as mentioned in the first comment.