for(int i=0;i<n;i++)
{
for(int j=i;j<n;j++)
{currentsum=0;
currentsum=cumsum[j]-cumsum[i-1];
IN THIS IF WE TAKE i=0 then j=0
so cumsum[i-1] = cumsum[-1] which is not valid input
pls explain this thin
for(int i=0;i<n;i++)
{
for(int j=i;j<n;j++)
{currentsum=0;
currentsum=cumsum[j]-cumsum[i-1];
IN THIS IF WE TAKE i=0 then j=0
so cumsum[i-1] = cumsum[-1] which is not valid input
pls explain this thin
Hey Harshal, there will be an if check,
if (i > 0){
currentsum=cumsum[j]-cumsum[i-1];
}
else{
currentsum=cumsum[j];
}
thanks for correcting.