Transpose of Matrix In-place You are given a M * N matrix, find Transpose of Matrix in-place.Transpose of matrix is obtained by interchanging rows and columns of a matrix that is by changing rows to columns and columns to rows.

Lets understand the problem statement graphically and it will be more clear,

Algorithm

Below Algorithm will only work for a Square Matrix that is having same number of Rows and Columns.Transpose of given matrix can be obtained by changing its rows to columns and columns to rows.

Post a Comment

I'm Jayesh Patel, author of "JavaByPatel". I'm not a professional blogger but when time permits, love to share in-depth solutions to common Interview questions asked.Any questions/feedback, Please drop a mail atjayeshmaheshpatel@gmail.com