Spiral print anti clockwise

why is my code failing for some test cases?

@Arshabh
this is your corrected code