Book allocation problem(ch)

https://ide.codingblocks.com/s/61582
wrong answer

Hi Shubham, you need to add one more condition in your isvalid function i.e.

if(a[i]>mid){
return false;
}

Also, if if((intialcount+a[i])>mid), we would set the value of initialcount = a[i] and not mid.
I’ve made these changes and you can refer to them here:
https://ide.codingblocks.com/s/61664