Spiral matrix generation
Your task
Given a positive integer n, generate an n x n matrix filled with the integers 1 to n*n in clockwise spiral order starting from the top-left corner. Return the matrix. 1 <= n <= 20.
Examples
spiral_generate(n: int) -> list[list[int]]Example 1
Input
spiral_generate(3)Output
[[1, 2, 3], [8, 9, 4], [7, 6, 5]]