Spiral print 2d matrix

https://hack.codingblocks.com/contests/c/509/220
https://ide.codingblocks.com/#/s/30805
2 test cases are wrong

INPUT:
4 5
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20

OUTPUT:
1, 2, 3, 4, 5, 10, 15, 20, 19, 18, 17, 16, 11, 6, 7, 8, 9, 14, 12, 13, END
EXPECTED OUTPUT:
1, 2, 3, 4, 5, 10, 15, 20, 19, 18, 17, 16, 11, 6, 7, 8, 9, 14, 13, 12, END

I have corrected your code and commented the change.
https://ide.codingblocks.com/#/s/30884

1 Like

yes got it, but i got the full score on the same mistake when i attempted the anticlockwise spiral print !!!

Test cases may be weak sometimes.

1 Like