A cool algorithm to check a Sudoku field?

前端 未结 25 785
清酒与你
清酒与你 2021-01-30 09:19

Does anyone know a simple algorithm to check if a Sudoku-Configuration is valid? The simplest algorithm I came up with is (for a board of size n) in Pseudocode

f         


        
25条回答
  •  执念已碎
    2021-01-30 10:01

    Here is what I just did for this:

    boolean checkers=true;
    String checking="";
        if(a.length/3==1){}
        else{
           for(int l=1; l9||a[i][j]<1){
                    checkers=false;
                    break;
                }
                else{
                    col[a[i].length-j][i]=a[i][j];
                }
            }
        }
        String alia="";
        for(int i=0; i

提交回复
热议问题