This website contains ALL LeetCode **Premium** problems for
**FREE!!**.

All leaked interview problems are collected from Internet.

All leaked interview problems are collected from Internet.

Given an integer *n*, generate a square matrix filled with elements from 1 to *n*^{2} in spiral order.

For example,

Given *n* = `3`

,

[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ] ]

b''