Given a matrix of size r*c. Traverse the matrix in spiral form.
link to the Question:- https://practice.geeksforgeeks.org/problems/spirally-traversing-a-matrix-1587115621/1#
Details
We have given a matrix and we have to display it's spiral form.
For Example:-
Input:
r = 4, c = 4
matrix[][] = {{1, 2, 3, 4},
{5, 6, 7, 8},
{9, 10, 11, 12},
{13, 14, 15,16}}
Output:
1 2 3 4 8 12 16 15 14 13 9 5 6 7 11 10
Aim
Given a matrix of size r*c. Traverse the matrix in spiral form. link to the Question:- https://practice.geeksforgeeks.org/problems/spirally-traversing-a-matrix-1587115621/1# Details We have given a matrix and we have to display it's spiral form. For Example:- Input: r = 4, c = 4 matrix[][] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15,16}} Output: 1 2 3 4 8 12 16 15 14 13 9 5 6 7 11 10
Programming language