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;}

--

--

--

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
Alysia Wu

Alysia Wu

Scientist, Technologist, Philosopher. This me deciphering the word..

More from Medium

What Is Event Propagation?

JS is Compiler or Interpreter Language

Where do Higher Order Components come from?

The Journey to Juno College