题出自https://leetcode.com/problems/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?
简单的说就是给出一个n*n的二维数组,然后把这个数组进行90度顺时针旋转,而且不能使用额外的存储空间。
最初拿到这道题想到的就是找出每个坐标的旋转规律。假设我们是2*2的矩阵:
a b
c d