Everytime forget to - '0'!!!!!!!
1 class Solution { 2 public: 3 bool isValid(vector&rec, int value) { 4 if (value < 0) return true; 5 if (rec[value]) return false; 6 rec[value] = true; 7 return true; 8 } 9 bool isValidSudoku(vector > &board) {10 if (board.size() != 9 || board[0].size() != 9) return false;11 for (int i = 0; i < 9; i++) {12 vector row(10, false), column(10, false), sub(10, false);13 for (int j = 0; j < 9; j++) {14 if (!isValid(row, board[i][j] - '0') ||15 !isValid(column, board[j][i] - '0') ||16 !isValid(sub, board[(i/3)*3 + j/3][(i%3)*3 + j%3] - '0')) {17 return false;18 }19 }20 }21 return true;22 }23 };