leetcode 48. Rotate Image
来源:互联网 发布:大乐斗门派心法数据 编辑:程序博客网 时间:2024/06/05 22:44
leetcode 48. Rotate Image
本地变换的主要思想是找规律: 先做装置变换,再转列对称变换
以下是Python代码:
class Solution(object): def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ n = len(matrix) for i in range(n): for j in range(n): if i >= j: continue tmp = matrix[i][j] matrix[i][j] = matrix[j][i] matrix[j][i] = tmp for i in range(n/2): j = n-i-1 for k in range(n): tmp = matrix[k][i] matrix[k][i] = matrix[k][j] matrix[k][j] = tmp
0 0
- [LeetCode]48.Rotate Image
- LeetCode 48. Rotate Image
- LeetCode 48.Rotate Image
- LeetCode --- 48. Rotate Image
- [Leetcode] 48. Rotate Image
- [leetcode] 48. Rotate Image
- Leetcode 48. Rotate Image
- 48. Rotate Image LeetCode
- [LeetCode]48. Rotate Image
- leetcode 48. Rotate Image
- Leetcode 48. Rotate Image
- LeetCode 48. Rotate Image
- LeetCode *** 48. Rotate Image
- [LeetCode]48. Rotate Image
- LeetCode 48. Rotate Image
- LeetCode-48.Rotate Image
- [LeetCode] 48. Rotate Image
- LeetCode 48. Rotate Image
- GitHub命令行上传项目
- DES加密的python实现
- Could not create the view: An unexpected exception was thrown.
- Python中切片总结
- 九度OJ题目1438:最小公倍数
- leetcode 48. Rotate Image
- mysql
- os学习中,遇到元组,原先随意看看的在认真学习一下了额
- 程序员面试金典——翻转子串
- ZOJ-3972 Beauty of Array
- Window操作系统注册表学习
- <mvc:annotation-driven />注解详解
- Linux网络服务参数配置说明及实战
- svn查看不到自己最近的log