Sir , as told in the video im doing the same but when i initlaize int cumSum[100]={0}; but on line where currentsum=cumSum[j] - cumSum[i-1]; let say i = 1 and j=1
then cumSum[-1] should be zero but its coming as -2 which in turns ruining the whole answer please tell how to fix this
Cummalitive sum at negtaive index not initialized as 0 but as -2
Hey @mdhammad139
Yes we have to add one constraint which Sir missed
if(i>=1)
current_sum = cum_sum[j] + cum_sum[i-1];
else
current_sum= cum_sum[j] ;
*let say i=0;j=0 i meant to say instead of i=1 j=1
…