Only one test case not passing

why is my code not passing a single test case.Explain the error in my code and help me rectify it . Don’t suggest other codes.

@D19APPPP0016 here just added <= two places commented


i hope its clear if yes dont forget to mark it as resolved and hit like :smiley:

Got accepted and tell me why we have not put if condition in while loop and explain the corner cases in more detail.Don’t give the explanation provided in solutions.

@D19APPPP0016 here check for this type of input
2 4
1 2 3 4
5 6 7 8
debug your code using this case it gives wrong

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.