Number of rows and cols
let n = A . length ; let m = A [ 0 ] . length ; let row = new Array ( n ) ; let col = new Array ( n ) ; for ( let i = 0 ; i < n ; i ++ ) { row [ i ] = new Array ( m ) ; col [ i ] = new Array ( m ) ; }