Public class sudokuverifier {private boolean is1to9row (int[][] a, int R) {int[] pos = new int[9];for (int i = 0; i < 9; i++) {if (pos[a[r][i]] == 1) return false;pos[a[r][i]] = 1;} for (Int i : pos) {if (i == 0) Return false;} Return true;} Private boolean is1to9column (int[][] a, int c) {int[] pos = new int[9];for (int i = 0; i < 9; i++) {if (Pos[a[i][c] ] == 1) return false;pos[a[i][c]] = 1;} for (Int i : pos) {if (i == 0) Return false;} Return true;} Private boolean is1to9sec (int[][] a, int x, int y) {int[] pos = new int[9];for (int i = 0 ; i < 3 ; i ++) {for (int j = 0 ; j < 3 ; j ++) {if (pos[a[x + i][x + j]] == 1) return false;pos[a[x + i][x + j]] = 1;}} for (Int i : pos) {if (i == 0) Return false;} Return true;} o (n) private boolean isvalid (int[][] a) {// assumes...for (int i = 0 ; i < 9 ; i ++) {// rowsif (!is1To9Row (a, i)) return false;// columnsif (!is1to9column (a, i)) Return false;} Secsfor (int i = 0 ; i < 9 ; i += 3) { for (int j = 0 ; j < 9 ; j += 3) {if (! Is1to9sec (A,&NBSP;I,&NBSP;J)) Return false;}} Return true;}}
A Sudoku Verifier