Generate an n x n matrix containing the integers from 1 through n² in clockwise spiral order, starting at the top-left corner.
Input / output
n: integerinteger[][]Examples
n = 3 returns [[1,2,3],[8,9,4],[7,6,5]].n = 1 returns [[1]].Constraints
1 <= n <= 50Follow-up Can you describe the loop invariant for the four moving boundaries and avoid special-case center logic?