摘要:
Given an integern, generate a square matrix filled with elements from 1 ton2in spiral order.For example,Givenn=3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7, 6, 5 ]]class Solution {public: vector > generateMatrix(int n) { // Start typing your C/C++ solution below... 阅读全文