首页 > 学院 > 开发设计 > 正文

LeetCode 48 --- Rotate Image

2019-11-08 02:17:34
字体:
来源:转载
供稿:网友

题目链接: LeetCode 48 — Rotate Image

AC代码:

public class PRoblem48 { public static void main(String[] args) { // TODO Auto-generated method stub int [][] ss={{1,2},{3,4}}; rotate(ss); } public static void rotate(int[][] matrix) { int n=matrix.length-1; int[][] mm=new int[n+1][n+1]; for(int i=0;i<=n;i++) for(int j=0;j<=n;j++) mm[i][j]=matrix[i][j]; for(int i=0;i<=n;i++) for(int j=0;j<=n;j++){ //System.out.println(mm[n-j][i] +" "+":" + (n-j) +" : "+i); matrix[i][j]=mm[n-j][i]; } }}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表