//鬼晓得上下反转,对角翻转之后竟然正好顺时针九十度,数学事体育老师教的
class Solution {
public:
void rotate(vector<vector<int>>& matrix) {
if(matrix.size()==)return ;
int size=matrix.size();
for(int i=;i<size/;i++)
{
for(int j=;j<size;j++)
{
int tmp=matrix[i][j];
matrix[i][j]=matrix[size--i][j];
matrix[size--i][j]=tmp;
}
}
for(int i=;i<size;i++)
{
for(int j=i;j<size;j++)
{
int tmp=matrix[i][j];
matrix[i][j]=matrix[j][i];
matrix[j][i]=tmp;
}
} return ;
}
};

Leetcode048. Rotate Image的更多相关文章

  1. Canvas绘图之平移translate、旋转rotate、缩放scale

    画布操作介绍 画布绘图的环境通过translate(),scale(),rotate(), setTransform()和transform()来改变,它们会对画布的变换矩阵产生影响. 函数 方法 描 ...

  2. [LeetCode] Rotate Array 旋转数组

    Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array  ...

  3. [LeetCode] Rotate List 旋转链表

    Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given 1 ...

  4. [LeetCode] Rotate Image 旋转图像

    You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). ...

  5. jQuery.rotate.js参数

    CSS3 提供了多种变形效果,比如矩阵变形.位移.缩放.旋转和倾斜等等,让页面更加生动活泼有趣,不再一动不动.然后 IE10 以下版本的浏览器不支持 CSS3 变形,虽然 IE 有私有属性滤镜(fil ...

  6. CSS3属性transform详解之(旋转:rotate,缩放:scale,倾斜:skew,移动:translate)

    CSS3属性transform详解之(旋转:rotate,缩放:scale,倾斜:skew,移动:translate)   在CSS3中,可以利用transform功能来实现文字或图像的旋转.缩放.倾 ...

  7. 偏移:translate ,旋转:rotate,缩放 scale,不知道什么东东:lineCap 实例

    <!DOCTYPE HTML> <head> <meta charset = "utf-8"> <title>canvas</ ...

  8. 记一道有意思的算法题Rotate Image(旋转图像)

    题出自https://leetcode.com/problems/rotate-image/ 内容为: You are given an n x n 2D matrix representing an ...

  9. iOS 2D绘图 (Quartz2D)之Transform(CTM,Translate,Rotate,scale)

    前言:Quartz默认采用设备无关的user space来进行绘图,当context(画板)建立之后,默认的坐标系原点以及方向也就确认了,可以通过CTM(current transformation ...

随机推荐

  1. Can not perform this action after onSaveInstanceState

    java.lang.RuntimeException: Unable to resume activity {com.tongyan.nanjing.subway/com.tongyan.struct ...

  2. PLSQL_数据泵导入导出数据Impdp/ Expdp(概念)

    2014-08-31 Created By BaoXinjian

  3. BEvent_标准BusinessEvent用以监控供应商的修改(案例)

    2014-06-01 Created By BaoXinjian

  4. c++学习-链表

    静态链表: #include<iostream> #include<string> using namespace std; struct book{ int num; flo ...

  5. 从千分位格式化谈JS性能优化

    所谓的千分位形式,即从个位数起,每三位之间加一个逗号.例如“10,000”.针对这个需求,我起初写了这样一个函数: // 方法一function toThousands(num) {var resul ...

  6. 在eclipse中下载包含子模块(Submodules)的git项目

    先将项目下载下来 , 这时由于是子项目的原因 , 下载的项目中不包含任何子项目 . 这时在eclipse的Git Repositories中 , 选中Submodules , 右键点击update即可 ...

  7. JAVA 匿名对象

    /* 匿名对象: 没有名字的对象 匿名对象的使用方式之一: 当对对象方法只调用一次时,我们可以用匿名对象来完成,比较简化. 匿名对象的使用方式之二: 匿名对象可以被当做实参传递 */ class Ca ...

  8. webview和 内置浏览器的调用

    http://blog.csdn.net/hudashi/article/details/8176298/ 一.启动android默认浏览器 在Android程序中我们可以通过发送隐式Intent来启 ...

  9. Rstudio匹配中文

    之前在操作csv文件时一般是将中文字符在excel或用Perl将其中的中文转换成对应的英文,但是最近碰到不得不在R里面进行中文符操作,发现R里面的匹配是无法识别的中文符的.比如: df <- r ...

  10. NLog文章系列——如何配置NLog

    NLog支持以多种不同方式配置,目前同时支持直接编程和使用配置文件两种方法.本文将对目前支持的各种配置方式作详细描述. 日志配置 通过在启动的时候对一些常用目录的扫描,NLog会尝试使用找到的配置信息 ...