Watch the algorithm fill result[j][i] = matrix[i][j] — one assignment at a time.
matrix
3×5
result
5×3