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

Commitd468888

Browse files
committed
found a bug when I test it
at line 46, if you do not times 3, some positions would never be checked while some positions were checked many times.
1 parent2d279dc commitd468888

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎hash/IsValidSudoku.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static boolean isValidSudoku(char[][] board) {
4343
// clear the set at every block.
4444
set.clear();
4545
for (intk =0;k <9;k++) {
46-
if (!isValidChar(board[i +k /3][j +k %3],set)) {
46+
if (!isValidChar(board[i*3 +k /3][j*3 +k %3],set)) {// here is a bug
4747
returnfalse;
4848
}
4949
}
@@ -71,4 +71,4 @@ public static boolean isValidChar(char c, HashSet<Character> set) {
7171

7272
returntrue;
7373
}
74-
}
74+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp