Function to return the number of cells in which mirror can be placed
function numberOfCells ( mat ) { let row = new Array ( N ) ; let col = new Array ( N ) ; for ( let i = 0 ; i < N ; i ++ ) { row [ i ] = new Array ( N ) ; col [ i ] = new Array ( N ) ; for ( let j = 0 ; j < N ; j ++ ) { row [ i ] [ j ] = 0 ; col [ i ] [ j ] = 0 ; } }