Book allocation

https://ide.codingblocks.com/#/s/28420

this is the link i got the solution but have a small doubt ,when startPages=0,its giving me wrong answer and when it is set to startPages=max(books[i],startPages),its working but i guess it should even work with startPages=0,if i am wrong please tell me why it will not work

I dnt know the question, but your code is similar to painter’s partition problem, and assuming this, startPages=max(books[i],startPages) is correct and =0 is wrong. We can give max(books[i]) to one of the students, so to consider that case we use max.


for better understanding