Test cases 0 to 8 not solved

Test cases 0 to 8 are not solved. Please let me know the issue with the following code.

Code Link: https://ide.codingblocks.com/s/578779

Please refer to the following code and let me know the issue with the code. Code Link: https://ide.codingblocks.com/s/578779

Hi. Firstly sorry for delay.
So the the first thing that u were doing wrong is sorting. In question it is mentioned that “painter will only paint contiguous sections of board.” so if u sort the array then then array basically changes.

Rest I have made changes to ur code.


It is passing all the test cases now. Hope it clears all ur doubts.

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.