Painter problem


What is the problem with this code? All the sample inputs are showing correct output , but none of the test cases are getting passed.

@AbhilashaBansal You cannot sort the boards as it would change the order of wooden blocks.