Spiral Matrix

Understand and solve the interview question "Spiral Matrix".


Given an m * n matrix, you have to return all the matrix elements in spiral order. The spiral order signifies traversing the matrix in clockwise order.

Let’s review the spiral order below:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.