48. Rotate Image

You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:Could you do this in-place?

public class Solution {
    public void rotate(int[][] matrix) {
        int n = matrix.length;
        int[][] A = new int[n][n];
        for(int i=0;i

你可能感兴趣的:(48. Rotate Image)