Untitled

mail@pastecode.io avatar
unknown
plain_text
14 days ago
444 B
0
Indexable
Never
 * @param {number[][]} matrix
 * @return {number[][]}
 */
var transpose = function(matrix) {
    
    let array = new Array(matrix[0].length).fill(new Array(matrix.length).fill(0))

    

    for(let i = 0; i < matrix.length; i++){
        for(let j = 0; j < matrix[i].length; j++){
            console.log(matrix[i][j])
            console.log(array[j][i])
            array[j][i] = matrix[i][j];

        }

    }

    console.log(array)


};
Leave a Comment