transposeMatrix
to transform the matrix into its Transpose - in-place. int rows = matrix.length
and int columns = matrix[0].length
. Once you have the row / column dimensions (in this case, the same), write 2 for loops that traverse the top half of the square matrix. In the inner for loop, use a temporary variable to make the swap. temp = matrix[i][
matrix[i][j] = matrix[j][
matrix[j][i] = temp;
public static void transposeMatrix(int[][] matrix) { }
C
Java
Python