Painter Problem

Only Sample Test case is passed.I am unable to find anything wrong in my logic,Pls help

Pls share your code by saving on ide so that I could check it…

Pls refer to this edited code… Try to submit it now…