File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed 
src/main/java/g0001_0100/s0051_n_queens Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1010public  class  Solution  {
1111    public  List <List <String >> solveNQueens (int  n ) {
1212        char [][] board  = new  char [n ][n ];
13-         for  (int  i  = 0 ; i  < n ; i ++) for  (int  j  = 0 ; j  < n ; j ++) board [i ][j ] = '.' ;
14-         List <List <String >> res  = new  ArrayList <List <String >>();
13+         for  (int  i  = 0 ; i  < n ; i ++) {
14+             for  (int  j  = 0 ; j  < n ; j ++) {
15+                 board [i ][j ] = '.' ;
16+             }
17+         }
18+         List <List <String >> res  = new  ArrayList <>();
1519        int [] leftRow  = new  int [n ];
1620        int [] upperDiagonal  = new  int [2  * n  - 1 ];
1721        int [] lowerDiagonal  = new  int [2  * n  - 1 ];
@@ -30,7 +34,6 @@ void solve(
3034            res .add (construct (board ));
3135            return ;
3236        }
33- 
3437        for  (int  row  = 0 ; row  < board .length ; row ++) {
3538            if  (leftRow [row ] == 0 
3639                    && lowerDiagonal [row  + col ] == 0 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments