There is some problem in the code written by prateek bhaiya

this code is failing for below test case

2 3
5 11 30
5 19 19

image
in line 29 and 36 u had used < while it should be <=
I have corrected ur code https://ide.codingblocks.com/s/588234

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.