Confusion with a statement

i have seen in many problems that we sometimes thake i-j
and sometimes is i-j-1 here too sir has taken mid-(i-1) like whats the intution can you please help me like when to take which

it may be something because of using 1 based index or 0 based index

in order to come forth such problem try a dry run on pen and paper and check which works for u

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.