Created
August 5, 2021 14:01
-
-
Save c7x43t/b4dcf257818a2d54a0e11d995e8ec082 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function transpose(matrix){ | |
var n=matrix.length; | |
var m=matrix[0].length; | |
var result=new Array(m); | |
for(var i=0;i<m;i++){ | |
result[i]=new Array(n); | |
for(var j=0;j<n;j++){ | |
result[i][j]=matrix[j][i]; | |
} | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment