矩阵神马的最讨厌了!!转的我头疼!明天待我刷完rotation和旋转矩阵一放在一起
Rotate Matrix
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
从最外层开始一层一层剥掉
Spiral Matrix I
先做了2 看了答案觉得网上答案思路比我清晰一些 然后用他的方法做了1. II的答案搞了两个数 分别记住第一行和最后一行的位置。每绕一圈指针分别加1减1.类似的,spiral matrix I可以搞四个数记住每一圈四个顶点的位置。每绕一圈四个数往里面缩一圈。如果是奇数行/列需要特别考虑一下最中间的那一行/列
Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.