Problem with initial start point of binary search


my code is working but earlier when i took s=0 instead of s= arr[n-1] it was failing for all cases. in the lecture bhaiya had said we can start from 0 too . plz explain why s=0 isnt working

Hello @pratik.win no you cant start with 0 in this question.
there is reason in binary search question the main logic we have to aply in deciding range only.
in this question the range should start with the maximum element in the array and last upto the sum of all the elements.
this is because if there is one student the time he can take in reading all these books is the sum of all the pages.
but if the number of students is equal to the number of books i.e the number of elemts in the array then we have the option that every student can read one book.
this is the reason for this .
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.