首页 > 试题广场 >

像素翻转

[编程题]像素翻转
  • 热度指数:31129 时间限制:C/C++ 3秒,其他语言6秒 空间限制:C/C++ 32M,其他语言64M
  • 算法知识视频讲解

现有一个NxN的矩阵,阶数为N,请编写一个算法将矩阵顺时针旋转90度并将其作为返回值。要求不使用缓存矩阵,保证N不大于500,元素不大于256,每个元素用int表示。


测试样例:
[[1,2,3],[4,5,6],[7,8,9]],3
返回:[[7,4,1],[8,5,2],[9,6,3]]
头像 Jorunnaparva
发表于 2020-10-07 09:07:46
class Transform { public: vector<vector<int> > transformImage(vector<vector<int> > mat, int n) { reverse(mat.begin 展开全文
头像 清心_恋旧
发表于 2019-07-26 10:49:08
public int[][] transformImage(int[][] mat, int n) {         // write code here         int[][] result = new in 展开全文
头像 牛客314328168号
发表于 2023-02-10 23:55:15
#include <vector> class Transform { public: vector<vector<int> > transformImage(vector<vector<int> > mat, int n) { 展开全文
头像 牛客548207004号
发表于 2023-11-09 11:03:21
import java.util.*; public class Transform { public int[][] transformImage(int[][] mat, int n) { // write code here int [][] mat2 展开全文