Given a matrix, return all elements of the matrix in spiral order.
Sample Input:
[[1,2,3],[4,5,6],[7,8,9]]
Sample Output:
[1,2,3,6,9,8,7,4,5]
Hints
Hint 1
Use four pointers: top, bottom, left, right
Hint 2
Traverse right, down, left, up in sequence
Hint 3
Adjust pointers after each direction is completed