transpose-matrix

var transpose = function(A) {
if (A.length ===0 || A[0].length === 0) return A;
let res = new Array(A[0].length);for (let i = 0; i < res.length; i ++) {res[i] = new Array(A.length);for (let j = 0; j < res[i].length; j ++) {res[i][j] = A[j][i];}}return res;}

--

--

Founder & CEO futurelab.world. Scientist, Technologist, Philosopher. This me deciphering the word..

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store