給定 n,生成 n×n 矩陣,元素 1~n² 按順時針螺旋順序填充。
例:n=3 → [[1,2,3],[8,9,4],[7,6,5]]。
維護四條邊界 top, bottom, left, right,當前填充值 val=1。
循環:
1. 左→右填充上行 top,top++。
2. 上→下填充右列 right,right--。
3. 若 top<=bottom,右→左填充下行 bottom,bottom--。
4. 若 left<=right,下→上填充左列 left,left++。
直到 val > n*n。