Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit25ca06e

Browse files
authored
Update 0036-valid-sudoku.js
1 parentaf97625 commit25ca06e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎javascript/0036-valid-sudoku.js‎

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

36-
consthasMoved=boxes[index][char]||cols[col][char]||rows[row][char];
36+
consthasMoved=boxes[index][(char-1)]||cols[col][(char-1)]||rows[row][(char-1)];
3737
if(hasMoved)returnfalse;
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
returntrue;
87-
}
87+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp