I have made everything unsigned long long and now 4 test cases are passing. Before that only one test case was passing.
But still 2 test cases are not passing. I dont know if it is a problem with the algorithm or there is overflow. If there is overflow i dont know what to do since everything is already unsigned long long.
Please help me solve this question.
2 test cases not passing in Painter Partition Problem
I have edited your code… Try to submit now…
Thank you! Sorry for taking so long to reply.
It is working now. But i still have one question. Why did we not sort the boards by length because in book allocation problem we had to sort the books. And if we dont sort in book allocation problem then we get wrong answer.
Here, its already mentioned in the question that : painter will only paint contiguous sections of board. This statement itself shows that array that will be given will be already in sorted order…
1 Like