Doubt in line no 35

there is a statement :
currentsum = cumsum[ j ] - cumsum[ i-1 ];
at i=0 , j=0 so how - cumsum[ 0-1 ] is not giving the error

hello @anujsharmabadboy
yeah some new compilers are allowing access to negative indices but it is bad practice and one should avoid doing that.
you can add one if statement to handle this corner case.
in this case currentsum=cumsum[j]