MCPcopy Create free account
hub / github.com/Hsinha11/Leetcode-solutions / swap

Method swap

48-rotate-image/48-rotate-image.java:2–9  ·  view source on GitHub ↗
(int[][] matrix)

Source from the content-addressed store, hash-verified

1class 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);

Callers 1

rotateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected