Spiral Matrix
所难
这个作者很懒,什么都没留下…
展开
-
LeetCode-Spiral Matrix
Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]原创 2014-08-13 22:37:51 · 313 阅读 · 0 评论 -
LeetCode-Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.For example,Given n = 3,You should return the following matrix:[ [ 1, 2, 3 ], [ 8, 9, 4 ], [原创 2014-08-13 20:25:25 · 332 阅读 · 0 评论 -
LeetCode-Rotate Image
You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?Solution:Code:class Solution {public: void原创 2014-08-14 21:51:53 · 324 阅读 · 0 评论