Book allocation

i cant understand why start=a[n-1];

Hello @sagar_aggarwalafter sorting the array we are starting our binary search from thus point because our range will start from it.
If there are number of students equal to the number of books then the book with the maximum pages will be the starting of the range and if there is only one student then the ending will be the sum of all the elements in the array.

1 Like

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.