Given a positive integer n, generate an n x n matrix filled with elements from 1 to n^2 in spiral order.
The spiral order starts from the top-left corner and moves right, then down, then left, then up, repeating this pattern layer by layer until all cells are filled.
1 <= n <= 20n = 3[[1,2,3],[8,9,4],[7,6,5]]n = 1[[1]]