class Solution
{
public void rotateBy90(int [][]mat)
{
// Your code here
var n = mat[0].length;
var l = matrixTranspose(mat,n);
for(var i=0;i<n;i++)
{
for(var j=n-1;j>=0;j--)
{
System.out.print(l[i][j]+" ");
}
System.out.println();
}
}
public int[][] matrixTranspose(int[][] mat, int n)
{
//Write your code here
var b = new boolean[n][n];
for(var i=0;i<n;i++)
{
for(var j=0; j<n; j++)
{
if(!b[i][i])
{
var t = mat[i][j];
mat[i][j] = mat[j][i];
mat[j][i] =t;
b[i][j] = true;
b[j][i]=true;
}
}
}
return mat;
}
}