Рет қаралды 5,839
It is an interesting question where we have to traverse a matrix in a spiral format.
So the question is, we have to write a program to print the elements of a given 2D array/matrix of size m*n in spiral order.
So for the matrix,
1,2,3,
4,5,6
7,8,9
The output will be 1,2,3,6,9,8,7,4,5.
Let's see how we can come up with an approach to deal with this program and solve it.
Hint - We are again and again moving in a pattern as left to right, top to bottom, right to left, and bottom to top. You have to use this pattern to approach the program.
Subscribe @TAPACADEMY
For more information, fill this form: forms.gle/8eiU...
or call us at 8884881203
Facebook: / thetapacademy
Instagram: / tapacademy_online
Linkedin: / 73820805
Website: www.thetapacad...