Getting wrong Index Number!

I wrote the same code as prateek bhiaya explained in the video, but I am getting “index+1” in my answer.

Can you please solve this issue & explain it to me in detail??

My Code -> https://ide.codingblocks.com/s/578827

Thank you🙏

hi shivam.
I have corrected ur code.i have also created another function. it was very easy to understand and works in O(logN).


Hope this clears ur doubts

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.

I need recursive approach

there is recursive code also in the the link i shared and its working perfectly fine.

okky I got it, thank you

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.