
描述
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?
分析
将矩阵顺时针旋转90°,等同于先沿水平中线翻转,再按主对角线翻转。
代码
Python
1 |
class (object): |

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?
将矩阵顺时针旋转90°,等同于先沿水平中线翻转,再按主对角线翻转。
1 |
class (object): |
近期评论