Book allocation problem

on compilation answer is coming correct but test cases are not passing

intialise s with pages[book-1];
Reason
The task is to assign books in such a way that the maximum number of pages assigned to a student is minimum.

The minimum possible answer cannot be less than maximum of given pages,
let n=5 and pages are 10,40,20,30 then answer cannot be less than 40,as atleast one of the students will be assigned that 40 page unit!

Modified Code

now it is passing all testcases

i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course

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.