Maximum subarray 2

what happen when i=0,j=0???
In this case how compiler will calculate currentsum…Because compiler have to calculate cumsum[-1].

Hi @Avishek-Kumar-2445349249011561
For calculating cumsum we first take cumsum[0] = arr[0];
Then start from i=1 and calculate remaining cumsum.
And for calculating currsum initialise i from 1 and j from i-1. Then compiler wont access arr[-1].

what happen if all the element in array is negative…