2 test cases failing in Painter Problem

This is my code https://ide.codingblocks.com/s/161056
It is passing 2 test cases and failing 2. What should I change ?

Shruthi, could you pls add few comments in your code so that I could understand it…


I’ve added comments now

Shruthi, your code is correct, only change line no 73 of your code, as :
ll ans=binarysearch(n,k,t,length);
and then try to submit the code…

1 Like

Thank you, it worked now!