Skip to content

Latest commit

 

History

History
24 lines (14 loc) · 301 Bytes

File metadata and controls

24 lines (14 loc) · 301 Bytes

Problem 54: Spiral Matrix

Difficulty: Medium

Problem

Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.

Example

Given the matrix

[
 [ 1, 2, 3 ],
 [ 4, 5, 6 ],
 [ 7, 8, 9 ]
]

Return [1,2,3,6,9,8,7,4,5]