Read the pages or book allocation problem

https://ide.codingblocks.com/#/s/16246
answer is coming out to be 0. please tell me the mistake in my code

question link: https://hack.codingblocks.com/contests/c/452/408

Yeah ! , of course you was getting zero because you written wrong statement in line no 12 (equality in wrong place ) and but that is not only the issue , you have to check wheather the current element of the array is less than or equal to current answer in boolean function or not , if not you need to return false because this cannot be your answer .
Here i modified ur code :stuck_out_tongue:
https://ide.codingblocks.com/#/s/16263

1 Like