(int[][] matrix)
| 1 | class Solution { |
| 2 | public void swap(int[][] matrix){ |
| 3 | int rows = matrix.length; |
| 4 | for(int i=0;i<rows/2;i++){ |
| 5 | int[] temp = matrix[i]; |
| 6 | matrix[i] = matrix[rows-1-i]; |
| 7 | matrix[rows-1-i] = temp; |
| 8 | } |
| 9 | } |
| 10 | public void rotate(int[][] matrix) { |
| 11 | int n = matrix.length; |
| 12 | swap(matrix); |