Skip to content

Commit 25ca06e

Browse files
authored
Update 0036-valid-sudoku.js
1 parent af97625 commit 25ca06e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

javascript/0036-valid-sudoku.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ var searchGrid = (board, boxes, cols, rows) => {
3333
const isEmpty = char === '.';
3434
if (isEmpty) continue;
3535

36-
const hasMoved = boxes[index][char] || cols[col][char] || rows[row][char];
36+
const hasMoved = boxes[index][(char - 1)] || cols[col][(char - 1)] || rows[row][(char - 1)];
3737
if (hasMoved) return false;
3838

39-
rows[row][char] = true; /* Space O(ROWS * COLS)*/
40-
cols[col][char] = true; /* Space O(ROWS * COLS)*/
41-
boxes[index][char] = true; /* Space O(ROWS * COLS)*/
39+
rows[row][(char - 1)] = true; /* Space O(ROWS * COLS)*/
40+
cols[col][(char - 1)] = true; /* Space O(ROWS * COLS)*/
41+
boxes[index][(char - 1)] = true; /* Space O(ROWS * COLS)*/
4242
}
4343
}
4444

@@ -84,4 +84,4 @@ var searchGrid = (board, boxes, rows, cols) => {
8484
}
8585

8686
return true;
87-
}
87+
}

0 commit comments

Comments
 (0)