Given a positive integer n, generate an n x n matrix filled with elements from 1 to n² in spiral order.
Sample Output:
[[1,2,3],[8,9,4],[7,6,5]]
Hints
Hint 1
Use four boundaries: top, bottom, left, right
Hint 2
Fill in spiral order: right, down, left, up
Hint 3
Adjust boundaries after each direction