We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
class Solution { public: bool isValidSudoku(vector<vector<char>>& board) { // brust way int a[9][9]; for(int i=0;i<9;i++) { for(int j=0;j<9;j++) { a[i][j] = board[i][j] == '.' ? - 1 : board[i][j] - '0'; } } int b[10][10], c[10][10]; int d[3][3][10]; for(int i=0;i<10;i++) { for(int j=0;j<10;j++) { b[i][j] = 0; c[i][j] = 0; } } for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { for(int k=0;k<10;k++) { d[i][j][k] = 0; } } } for(int i=0;i<9;i++) { for(int j=0;j<9;j++) { if(a[i][j] != -1) { b[i][a[i][j]]++; if(b[i][a[i][j]] > 1) return false; c[j][a[i][j]]++; if(c[j][a[i][j]] > 1) return false; d[i/3][j/3][a[i][j]]++; if(d[i/3][j/3][a[i][j]] > 1) return false; } } } return true; } };
The text was updated successfully, but these errors were encountered:
commit #5
c0afade
2ba5089
No branches or pull requests
The text was updated successfully, but these errors were encountered: