Function to display placed queen
function display ( n ) { breakLine ( ) ; document . write ( " " + ++ no ) ; breakLine ( ) ; for ( let i = 1 ; i <= n ; i ++ ) { for ( let j = 1 ; j <= n ; j ++ ) { if ( arr [ i ] != j ) { document . write ( " " ) ; } else { document . write ( " " ) ; } } document . write ( " " ) ; } breakLine ( ) ; }