I wanted to clarify something....for input 1 1 0 5 2 the expected output shows 1


#1

i wanted to clarify something…for input 1 1 0 5 2 the expected output shows 1 but if i am at the start index, i can move to the next and then next again but from there i can go no further…so no question of reaching the last index.


#2

The expected output for this case is 0. I guess you forgot to enter the first value in the input, i.e. the size of the input array. If you did, the judge would have taken it to be a one element array, hence the output 1.