2022.03.17 – NC069.BM99 顺时针旋转矩阵

文章目录
1. 题目2. 思路(1) 模拟法
3. 代码

1. 题目

2. 思路
(1) 模拟法
首先按照反对角线翻转数组,再按照水平对称翻转数组即可。
3. 代码
public class Test {
public static void main(String[] args) {
}
}

class Solution {
public int[][] rotateMatrix(int[][] mat, int n) {
for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { int temp = mat[i][j]; mat[i][j] = mat[j][i];

2022.03.17 – NC069.BM99 顺时针旋转矩阵最先出现在Python成神之路

版权声明:
作者:Zad
链接:https://www.techfm.club/p/25664.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>