• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
May 12, 2023 |3.7K Views
Spirally traversing a matrix
  Share  2 Likes
Description
Discussion

This video discusses a problem in which we have to traverse a matrix in a spiral form and print the elements of the matrix while we traverse. 
For example: For Input:  
           {{1,    2,   3,   4},
            {5,    6,   7,   8},
            {9,   10,  11,  12},
           {13,  14,  15,  16 }}

The output will be: 1 2 3 4 8 12 16 15 14 13 9 5 6 7 11 10

Checkout, the video for the complete explanation with implementation.

Practice Problem: https://practice.geeksforgeeks.org/problems/spirally-traversing-a-matrix-1587115621/1
Article: https://www.geeksforgeeks.org/print-a-given-matrix-in-spiral-form/
SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

Read More