as shown in this lecture that the formula for sum is cs[j]-cs[i-1] so what of i is 0 then i-1 becomes -1 shouldn’t it give errot?
What is i=0 then i-1 would be -1
yes it may give run time error
you have to check it explicitly
like this
if(i==0)
sum = cs[j];
else
sum = cs[j] - cs[i-1];
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.