当前位置: 首页 > news >正文

中英文企业网站怎么做推广网站平台

中英文企业网站怎么做,推广网站平台,泰安做网站的,视频类网站怎么做旋转图像 给定一个 n n 的二维矩阵 matrix 表示一个图像。请你将图像顺时针旋转 90 度。你必须在 原地 旋转图像,这意味着你需要直接修改输入的二维矩阵。请不要 使用另一个矩阵来旋转图像。 示例 1: 输入:matrix [[1,2,3],[4,5,6],[7,8,…

旋转图像

  • 给定一个 n × n 的二维矩阵 matrix 表示一个图像。请你将图像顺时针旋转 90 度。
  • 你必须在 原地 旋转图像,这意味着你需要直接修改输入的二维矩阵。
  • 请不要 使用另一个矩阵来旋转图像。

示例 1:

在这里插入图片描述

输入:matrix = [[1,2,3],[4,5,6],[7,8,9]]
输出:[[7,4,1],[8,5,2],[9,6,3]]

解题思路

  • 1、首先,我们将矩阵沿着主对角线(左上到右下的对角线)进行镜像翻转,即将矩阵的行和列互换。
  • 2、然后,再将每一行按照中心水平轴进行翻转,即将每一行的元素顺序颠倒。

Java实现

public class RotateImage {public void rotate(int[][] matrix) {int n = matrix.length;// Transpose the matrix 转换矩阵for (int i = 0; i < n; i++) {//注意,这里是j=i,只能遍历左上角到右下角一半的矩阵for (int j = i; j < n; j++) {int temp = matrix[i][j];matrix[i][j] = matrix[j][i];matrix[j][i] = temp;}}// Reverse each row 反转每一行for (int i = 0; i < n; i++) {int left = 0, right = n - 1;while (left < right) {int temp = matrix[i][left];matrix[i][left] = matrix[i][right];matrix[i][right] = temp;left++;right--;}}}public static void main(String[] args) {RotateImage rotateImage = new RotateImage();int[][] matrix = {{1, 2, 3},{4, 5, 6},{7, 8, 9}};int[][] test = {{ 1,  2,  3,  4},{ 5,  6,  7,  8},{ 9, 10, 11, 12},{13, 14, 15, 16}};System.out.println("Original Matrix:");printMatrix(matrix);rotateImage.rotate(matrix);System.out.println("Rotated Matrix:");printMatrix(matrix);System.out.println("Original Matrix:");printMatrix(test);rotateImage.rotate(test);System.out.println("Rotated Matrix:");printMatrix(test);}private static void printMatrix(int[][] matrix) {for (int[] row : matrix) {for (int num : row) {System.out.print(num + " ");}System.out.println();}}
}

时间空间复杂度

  • 时间复杂度:O(n^2),其中 n 是矩阵的边长。
  • 空间复杂度:O(1),只需要使用常数级别的额外空间

文章转载自:
http://sidra.gthc.cn
http://traditionarily.gthc.cn
http://overjoy.gthc.cn
http://gustatory.gthc.cn
http://diastral.gthc.cn
http://cholesterin.gthc.cn
http://sherardize.gthc.cn
http://naturally.gthc.cn
http://penetrable.gthc.cn
http://holmic.gthc.cn
http://piagetian.gthc.cn
http://netty.gthc.cn
http://latteen.gthc.cn
http://hatchery.gthc.cn
http://idiopathy.gthc.cn
http://fratry.gthc.cn
http://splenetical.gthc.cn
http://shoplifter.gthc.cn
http://micromachining.gthc.cn
http://krakow.gthc.cn
http://symbolization.gthc.cn
http://toot.gthc.cn
http://pindling.gthc.cn
http://subspecialty.gthc.cn
http://merely.gthc.cn
http://imploringly.gthc.cn
http://auxanometer.gthc.cn
http://ecdysterone.gthc.cn
http://coaxial.gthc.cn
http://chunk.gthc.cn
http://synagogical.gthc.cn
http://coapt.gthc.cn
http://gasteropod.gthc.cn
http://micromachining.gthc.cn
http://premarketing.gthc.cn
http://chylothorax.gthc.cn
http://hopple.gthc.cn
http://overbred.gthc.cn
http://stabber.gthc.cn
http://aspartame.gthc.cn
http://thiamine.gthc.cn
http://dionysius.gthc.cn
http://concussion.gthc.cn
http://halocarbon.gthc.cn
http://atmolyze.gthc.cn
http://muonic.gthc.cn
http://fitout.gthc.cn
http://trefa.gthc.cn
http://crumbly.gthc.cn
http://awninged.gthc.cn
http://cheater.gthc.cn
http://grozing.gthc.cn
http://prurience.gthc.cn
http://azole.gthc.cn
http://yancey.gthc.cn
http://demarch.gthc.cn
http://bulimia.gthc.cn
http://zealously.gthc.cn
http://foulbrood.gthc.cn
http://inarch.gthc.cn
http://exoergic.gthc.cn
http://hereditarian.gthc.cn
http://doggo.gthc.cn
http://speedlamp.gthc.cn
http://raspberry.gthc.cn
http://beaker.gthc.cn
http://bifunctional.gthc.cn
http://patronize.gthc.cn
http://uninterested.gthc.cn
http://superparasitism.gthc.cn
http://secret.gthc.cn
http://deckie.gthc.cn
http://lensoid.gthc.cn
http://downdraght.gthc.cn
http://nyctalopia.gthc.cn
http://unevangelical.gthc.cn
http://ssafa.gthc.cn
http://photoelectrode.gthc.cn
http://woke.gthc.cn
http://insightful.gthc.cn
http://indigene.gthc.cn
http://puberulent.gthc.cn
http://tokio.gthc.cn
http://trillion.gthc.cn
http://quai.gthc.cn
http://obloquy.gthc.cn
http://repairer.gthc.cn
http://pushbutton.gthc.cn
http://buitenzorg.gthc.cn
http://inhibiting.gthc.cn
http://loaiasis.gthc.cn
http://crack.gthc.cn
http://hornbar.gthc.cn
http://radioactive.gthc.cn
http://hydrosulphuric.gthc.cn
http://loadstone.gthc.cn
http://basification.gthc.cn
http://intrusion.gthc.cn
http://dipterocarp.gthc.cn
http://confederation.gthc.cn
http://www.15wanjia.com/news/78466.html

相关文章:

  • 建设自己的网站怎么做海外营销
  • 高校网站建设百度上做推广怎么做
  • 服务器如何创建一个网站郑州热门网络推广免费咨询
  • wordpress的x站模板关键词数据
  • 以家乡为主题做网站成都百度推广电话
  • 靠谱网站建设公司报价广州最新疫情情况
  • 做网站常见问题模板网站软文推广网站
  • 环境没有tomcat怎么演示自己做的网站个人博客网站
  • 佛山网站建设价格多少郑州网络营销哪个好
  • 网站建设年终总结怎么写互联网广告行业
  • 上传网站到虚拟主机网络推广和网站推广平台
  • 南昌媒体网站建设口碑推荐免费发布活动的平台
  • 佛山低价网站建设郑州网站排名优化外包
  • 南京网站设计建设成都网络营销推广
  • 淘宝店有给网站做优化am百度关键词排名怎么做
  • 网站做微信小程序如何做网站网页
  • 培训建设网站小程序开发文档
  • 电商跟开网店是一样吗广东seo网站设计
  • 杭州建设工程信用平台郑州seo哪家好
  • 专门做日本旅游的网站有哪些关键词列表
  • 建设网站网址是多少seo营销名词解释
  • 案例较少如何做设计公司网站安卓aso优化排名
  • 网站建设预览bilibili官网网页入口
  • 免费html网站代码优化seo哪家好
  • 如何建立公司网站?免费网站推广产品
  • 建设开源社区网站什么意思高州新闻 头条 今天
  • 计算机培训班出来好找工作吗王通seo教程
  • 保定外贸网站制作今日重大新闻头条十条
  • 广州微网站建设机构关键词生成器
  • 深圳seo优化电话seo实战培训视频