Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

transpose of the matrix in javascript

class Solution {
    solve(matrix) {
        let arr=[];
        for(let i=0;i<matrix.length;i++){
            arr.push([])
            for(let j=0;j<matrix.length;j++){
                arr[i].push(matrix[j][i])
            }
        }
        return arr
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #transpose #matrix #javascript
ADD COMMENT
Topic
Name
4+5 =