You are given an m x n matrix.
Your task is to return all elements of the matrix in spiral order, starting from the top-left corner and moving clockwise.
[ [1] ]
[1]
The matrix has only one element, so the spiral order is just [1].
[ [1, 2], [3, 4] ]
[1, 2, 4, 3]
Starting from the top-left (1), move right to (2), then down to (4), then left to (3).
[ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]
[1, 2, 3, 6, 9, 8, 7, 4, 5]
Starting from the top-left (1), move right to (2, 3), then down to (6, 9), then left to (8, 7), then up to (4), and finally right to (5).
[ [1] ]
[1]