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: cell (i, j) of the input becomes cell (j, i) of the output.
Note that the matrix may be rectangular (rows and columns counts can differ), so you generally cannot transpose it in place.