I’m not able to pass the last test case of this problem.
https://ide.codingblocks.com/s/56552
above is the code, its working fine for odd as well as even 2d arrays
2D-Spiral print anticlockwise
Hey Manit, your code is not working for some cases, for eg,
input:
2 8
1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16
your code’s output:
1, 9, 10, 11, 12, 13, 14, 15, 16, 8, 2, 3, 4, 5, 6, 7, END
but the expected output is:
1, 9, 10, 11, 12, 13, 14, 15, 16, 8, 7, 6, 5, 4, 3, 2, END
Hey Manit, as you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required. And please mark your doubts as resolved in your course’s “Ask Doubt” section, when your doubt is resolved.