Transpose of a Matrix

Transpose a Matrix Problem Given a 2D integer array matrix, return the transpose of matrix. The transpose of a matrix is the matrix flipped over its main diagonal, switching the matrix’s row and column indices. Example Example 1: $$ \begin{bmatrix} \colorbox{red} 1 & \colorbox{red} 2 & \colorbox{red}3 \\ \colorbox{green} 4 & \colorbox{green} 5 & \colorbox{green}6 \\ \colorbox{blue} 7 & \colorbox{blue} 8 & \colorbox{blue}9 \end{bmatrix} \Longrightarrow \begin{bmatrix} \colorbox{red} 1 & \colorbox{green} 4 & \colorbox{blue} 7 \\ \colorbox{red} 2 & \colorbox{green} 5 & \colorbox{blue} 8 \\ \colorbox{red} 3 & \colorbox{green} 6 & \colorbox{blue} 9 \end{bmatrix} $$ ...

This site uses cookies to improve your experience on our website. By using and continuing to navigate this website, you accept this. Privacy Policy