Print 2D matrix anti clockwise SPIRAL

https://hack.codingblocks.com/contests/c/474/219

https://ide.codingblocks.com/#/s/13270

i get ans. for three test cases but for one wrong ans…!! why ??
I had dry run for the sample test case … it’s giving correct output…

Hey ! try to think about the case when left column and right column becomes equal. i.e. for the test case 4 3
11 12 13
21 22 23
31 32 33
41 42 43
ur code is printing wring output. before printing buttom to top you should first check wheather this line is printed before or not that is if left and right are equal then this line was already printed before.

https://ide.codingblocks.com/#/s/13483

Got it ??

yes, I get it.
I haven’t taken these test cases into consideration… THANKS