标签:[1] span ids for ret char sudoku val code
public class Solution { public boolean isValidSudoku(char[][] board) { boolean[][][] used=new boolean[3][9][9]; for(int i=0;i<9;i++) for(int j=0;j<9;j++) if(board[i][j]!=‘.‘) { int idx=(int)board[i][j]-‘1‘; if(used[0][i][idx]==true) return false; used[0][i][idx]=true; if(used[1][j][idx]==true) return false; used[1][j][idx]=true; int k=i/3*3+j/3; if(used[2][k][idx]==true) return false; used[2][k][idx]=true; } return true; } }
标签:[1] span ids for ret char sudoku val code
原文地址:http://www.cnblogs.com/asuran/p/7580957.html