Painter Problem

Solution: https://ide.codingblocks.com/s/213117

what happening is if I am using sort function all the test cases are running fine except 0 and 1, and if I am not using sort function test cases 0 and 1 are right while all others are giving the wrong answer.

u are not supposed to sort the board in the question its given that the painters can paint contigous boards only
if u sort then positioning becomes different

check out this code this works well for all the test cases

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.