Update matrix_roation.java

pull/879/head
Lingeshwaran 2022-10-06 05:36:40 +05:30 committed by GitHub
parent 7e0476d351
commit 7adbce0033
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 0 deletions

View File

@ -28,3 +28,24 @@ void anti_rotate(vector<vector<int> > &matrix) {
swap(matrix[i][j], matrix[j][i]); swap(matrix[i][j], matrix[j][i]);
} }
} }
class solution{
public static void main(String args[]){
int arr[]={{1,2,3},
{4,5,6},
{7,8,9}}
rotate(arr);
for(int i=0;i<arr.length;i++){
for(int j=0;j<arr.lrngth;j++){
System.out.print(arr[i]+" ");
}
System.out.println();
}
anti_rotate(arr);
for(int i=0;i<arr.length;i++){
for(int j=0;j<arr.lrngth;j++){
System.out.print(arr[i]+" ");
}
System.out.println();
}
}
}