| 1 | class Solution |
| 2 | { |
| 3 | //Function to rotate matrix anticlockwise by 90 degrees. |
| 4 | static void rotateby90(int matrix[][], int n) |
| 5 | { |
| 6 | // code here |
| 7 | |
| 8 | for(int i=0;i<n/2;i++) |
| 9 | { |
| 10 | for(int j=i;j<n-i-1;j++) |
| 11 | { |
| 12 | // Store the first element |
| 13 | int temp = matrix[i][j]; |
| 14 | |
| 15 | matrix[i][j] = matrix[j][n-1-i]; |
| 16 | |
| 17 | matrix[j][n-1-i] = matrix[n-1-i][n-1-j]; |
| 18 | |
| 19 | matrix[n-1-i][n-1-j] = matrix[n-1-j][i]; |
| 20 | |
| 21 | matrix[n-1-j][i] = temp; |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | |
| 29 |
nothing calls this directly
no outgoing calls
no test coverage detected