59. Spiral Matrix II
2019-05-09
59. Spiral Matrix II
Given a positive integer _n_, generate a square matrix filled with elements from 1 to _n_2 in spiral order.
Example:
1 | Input: 3 |
Code:
1 | class Solution(object): |
1 | || => |9| => |8| |6 7| |4 5| |1 2 3| |