Leetcode048. Rotate Image
//鬼晓得上下反转,对角翻转之后竟然正好顺时针九十度,数学事体育老师教的
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的更多相关文章
- Canvas绘图之平移translate、旋转rotate、缩放scale
画布操作介绍 画布绘图的环境通过translate(),scale(),rotate(), setTransform()和transform()来改变,它们会对画布的变换矩阵产生影响. 函数 方法 描 ...
- [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 ...
- [LeetCode] Rotate List 旋转链表
Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given 1 ...
- [LeetCode] Rotate Image 旋转图像
You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). ...
- jQuery.rotate.js参数
CSS3 提供了多种变形效果,比如矩阵变形.位移.缩放.旋转和倾斜等等,让页面更加生动活泼有趣,不再一动不动.然后 IE10 以下版本的浏览器不支持 CSS3 变形,虽然 IE 有私有属性滤镜(fil ...
- CSS3属性transform详解之(旋转:rotate,缩放:scale,倾斜:skew,移动:translate)
CSS3属性transform详解之(旋转:rotate,缩放:scale,倾斜:skew,移动:translate) 在CSS3中,可以利用transform功能来实现文字或图像的旋转.缩放.倾 ...
- 偏移:translate ,旋转:rotate,缩放 scale,不知道什么东东:lineCap 实例
<!DOCTYPE HTML> <head> <meta charset = "utf-8"> <title>canvas</ ...
- 记一道有意思的算法题Rotate Image(旋转图像)
题出自https://leetcode.com/problems/rotate-image/ 内容为: You are given an n x n 2D matrix representing an ...
- iOS 2D绘图 (Quartz2D)之Transform(CTM,Translate,Rotate,scale)
前言:Quartz默认采用设备无关的user space来进行绘图,当context(画板)建立之后,默认的坐标系原点以及方向也就确认了,可以通过CTM(current transformation ...
随机推荐
- 7. redis优化
一. redis使用上的优化 精简键名和键值 键名:尽量精简,但是也不能单纯为了节约空间而使用不易理解的键名. 键值:对于键值的数量固定的话可以使用0和1这样的数字来表示,(例如:male/femal ...
- C#托管代码与C++非托管代码互相调用
http://www.cnblogs.com/Jianchidaodi/archive/2009/03/11/1407270.html#1473515 http://www.cnblogs.com/J ...
- RAC_Oracle集群服务安装RAC(案例)
2015-01-23 Created By BaoXinjian Thanks and Regards
- 白书 4.1.2 模运算的世界 P291
1.逆元 这里有个注意事项要说,就是当要求 (a-b)%m 的时候要注意不能直接 (a%m-b%m)%m 原因是得出的值有可能是负数,所以 (a%m-b%m+m)%m 才是正确的. //x,y是引用 ...
- rpm 与压缩解压缩
rpm包redhat package manager 逐渐地被linux发行版本使用的安装包 rpm -qa 查询所有linux中安装了那些rpm包 rpm -q mysql 查看mysql 包的信息 ...
- SPR EAD NET 6
SPR EAD_NET6 下载地址 http://www.gcpowertools.com.cn/downloads/trial/Spread.NET/EN_SPREAD_NET6_SETUP_RA_ ...
- 101、使用ContentProvider在应用间传递数据
[ContentWriter] package com.jikexueyuan.contentwriter; import android.content.ContentProvider; impor ...
- C API 连接MYSQL
#include <iostream> #include <mysql.h> #include <string> #include <assert.h> ...
- C++学习16 继承时的名字遮蔽
如果派生类中的成员变量和基类中的成员变量重名,那么就会遮蔽从基类继承过来的成员变量.所谓遮蔽,就是使用新增的成员变量,而不使用继承来的. 成员函数也一样,如果函数名和参数签名都相同,就会造成遮蔽.如果 ...
- eclipse中代码注释
1.类注释 Window->Preference->Java->Code Style->Code Template alt+shift+J 默认的快捷键 或者 先敲“/”在敲两 ...