Book Allocation problem

Here is my code:


It is passing the test case but is giving wrong ans. I have checked some other test cases also which are coming out to be correct. Can you tell me what is the problem

@Codecracaker532 You have set them minimum(low of binary search to be 0, which should be actually the last count of pages of last book (atleast one student will read last book also, even if he reads that book only then also the min of max will be the count of pages of last book)).
Second thing, try to use meaningful names for variables it will help you in debugging the code explaining it to others (especially in interviews) and use functions.


You can refer this code also.
If this solves your query mark it as resolved.

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.