Simple Enough D&C

I dont understand how to solve this using binary search, pls explain.

hello @shahpankti931 i don’t think you need to do this with the help of binary search .
you can solve this with the help of the for loop and the while loop which will the give time complexity of almost n(logn) .
here is the code for your reference .
https://ide.codingblocks.com/s/324276.
i hope i have cleared your doubt .
Happy Learning!!

1 Like

hello @shahpankti931 as you are not replying to the doubt i hope that your doubt is cleared and you can now mark this doubt as resolved.
on off the chance if you still have doubt you can mark reopen it and ask again.
Happy Learning !!

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.