Maximum subarray sum(cummulative sum)

How did we derive the equation
currentSum=cumSum[j]-cumSum[i-1] ?
And what is the case when i=0?
cumSum[-1]??

Hey @suhasjvrundavan
Sorry for delay
So how we come to that formulae
I say intutively
So assume u have 4 elements a b c d
And we make cummsum array
that is
a. a+b. a+b+c. a+b+c+d

Then sum from 3rd to 4th index will be c+d=a+b+c+d -(a+b)
Now see the formulae

Yeah for that u have to add an if statement above formulae is valid if i>0
Else currentsum=cumsum[i]