Unable to clear testcases

Time limit exceeds for the testcases with my code: https://ide.codingblocks.com/s/645037

hi @mitrapranav0027_5d705c8b616e0add
refer this -->

How did binary search work in this code? How am I supposed to figure out from the question that binary search will work?

Hi @mitrapranav0027_5d705c8b616e0add
Things will become clear with more and more practice only … and since u were getting tle u would have to think of optimised code only…

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.