A utility function to print solution matrix sol [ N ] [ N ]
function printSolution ( sol ) { for ( let i = 0 ; i < N ; i ++ ) { for ( let j = 0 ; j < N ; j ++ ) { document . write ( sol [ i ] [ j ] + " " ) ; } document . write ( " " ) ; } }