Please check the code, the code is behaving strangely

what strange behaviour is it showing?

Actually this is the solution for Bionic Array problem and This is not working. Can you please check for the errors. The code is not behaving as expected

which test cases are giving wrong answers?