Skip to content

Commit 3f67e37

Browse files
github-actionsgithub-actions
github-actions
authored and
github-actions
committed
Formatted with Google Java Formatter
1 parent d2d100b commit 3f67e37

File tree

2 files changed

+50
-52
lines changed

2 files changed

+50
-52
lines changed

src/main/java/com/examplehub/leetcode/middle/ValidSudoku.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package com.examplehub.leetcode.middle;
22

3-
/**
4-
* https://leetcode.com/problems/valid-sudoku/
5-
*/
3+
/** https://leetcode.com/problems/valid-sudoku/ */
64
public class ValidSudoku {
75
public static boolean solution1(char[][] board) {
86

9-
//travel all rows to check
7+
// travel all rows to check
108
for (int i = 0; i < 9; i++) {
119
int[] digitTable = new int[10];
1210
for (int j = 0; j < 9; j++) {
@@ -19,7 +17,7 @@ public static boolean solution1(char[][] board) {
1917
}
2018
}
2119

22-
//travel all columns to check
20+
// travel all columns to check
2321
for (int i = 0; i < 9; i++) {
2422
int[] digitTable = new int[10];
2523
for (int j = 0; j < 9; j++) {
@@ -32,8 +30,8 @@ public static boolean solution1(char[][] board) {
3230
}
3331
}
3432

35-
//travel all sub-box
36-
//TODO
33+
// travel all sub-box
34+
// TODO
3735
return true;
3836
}
3937

Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
1-
2-
31
package com.examplehub.leetcode.middle;
42

5-
import org.junit.jupiter.api.Test;
6-
73
import static org.junit.jupiter.api.Assertions.*;
84

5+
import org.junit.jupiter.api.Test;
6+
97
class ValidSudokuTest {
108

119
@Test
1210
void testSolution1() {
1311
char[][] board = {
14-
{'5', '3', '.', '.', '7', '.', '.', '.', '.'},
15-
{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
16-
{'.', '9', '8', '.', '.', '.', '.', '6', '.'},
17-
{'8', '.', '.', '.', '6', '.', '.', '.', '3'},
18-
{'4', '.', '.', '8', '.', '3', '.', '.', '1'},
19-
{'7', '.', '.', '.', '2', '.', '.', '.', '6'},
20-
{'.', '6', '.', '.', '.', '.', '2', '8', '.'},
21-
{'.', '.', '.', '4', '1', '9', '.', '.', '5'},
22-
{'.', '.', '.', '.', '8', '.', '.', '7', '9'},
12+
{'5', '3', '.', '.', '7', '.', '.', '.', '.'},
13+
{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
14+
{'.', '9', '8', '.', '.', '.', '.', '6', '.'},
15+
{'8', '.', '.', '.', '6', '.', '.', '.', '3'},
16+
{'4', '.', '.', '8', '.', '3', '.', '.', '1'},
17+
{'7', '.', '.', '.', '2', '.', '.', '.', '6'},
18+
{'.', '6', '.', '.', '.', '.', '2', '8', '.'},
19+
{'.', '.', '.', '4', '1', '9', '.', '.', '5'},
20+
{'.', '.', '.', '.', '8', '.', '.', '7', '9'},
2321
};
2422
assertTrue(ValidSudoku.solution1(board));
2523

26-
board = new char[][]{
27-
{'8', '3', '.', '.', '7', '.', '.', '.', '.'},
28-
{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
29-
{'.', '9', '8', '.', '.', '.', '.', '6', '.'},
30-
{'8', '.', '.', '.', '6', '.', '.', '.', '3'},
31-
{'4', '.', '.', '8', '.', '3', '.', '.', '1'},
32-
{'7', '.', '.', '.', '2', '.', '.', '.', '6'},
33-
{'.', '6', '.', '.', '.', '.', '2', '8', '.'},
34-
{'.', '.', '.', '4', '1', '9', '.', '.', '5'},
35-
{'.', '.', '.', '.', '8', '.', '.', '7', '9'},
36-
};
24+
board =
25+
new char[][] {
26+
{'8', '3', '.', '.', '7', '.', '.', '.', '.'},
27+
{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
28+
{'.', '9', '8', '.', '.', '.', '.', '6', '.'},
29+
{'8', '.', '.', '.', '6', '.', '.', '.', '3'},
30+
{'4', '.', '.', '8', '.', '3', '.', '.', '1'},
31+
{'7', '.', '.', '.', '2', '.', '.', '.', '6'},
32+
{'.', '6', '.', '.', '.', '.', '2', '8', '.'},
33+
{'.', '.', '.', '4', '1', '9', '.', '.', '5'},
34+
{'.', '.', '.', '.', '8', '.', '.', '7', '9'},
35+
};
3736
assertFalse(ValidSudoku.solution1(board));
3837
}
3938

4039
@Test
4140
void testSolution2() {
4241
char[][] board = {
43-
{'5', '3', '.', '.', '7', '.', '.', '.', '.'},
44-
{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
45-
{'.', '9', '8', '.', '.', '.', '.', '6', '.'},
46-
{'8', '.', '.', '.', '6', '.', '.', '.', '3'},
47-
{'4', '.', '.', '8', '.', '3', '.', '.', '1'},
48-
{'7', '.', '.', '.', '2', '.', '.', '.', '6'},
49-
{'.', '6', '.', '.', '.', '.', '2', '8', '.'},
50-
{'.', '.', '.', '4', '1', '9', '.', '.', '5'},
51-
{'.', '.', '.', '.', '8', '.', '.', '7', '9'},
42+
{'5', '3', '.', '.', '7', '.', '.', '.', '.'},
43+
{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
44+
{'.', '9', '8', '.', '.', '.', '.', '6', '.'},
45+
{'8', '.', '.', '.', '6', '.', '.', '.', '3'},
46+
{'4', '.', '.', '8', '.', '3', '.', '.', '1'},
47+
{'7', '.', '.', '.', '2', '.', '.', '.', '6'},
48+
{'.', '6', '.', '.', '.', '.', '2', '8', '.'},
49+
{'.', '.', '.', '4', '1', '9', '.', '.', '5'},
50+
{'.', '.', '.', '.', '8', '.', '.', '7', '9'},
5251
};
5352
assertTrue(ValidSudoku.solution2(board));
5453

55-
board = new char[][]{
56-
{'8', '3', '.', '.', '7', '.', '.', '.', '.'},
57-
{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
58-
{'.', '9', '8', '.', '.', '.', '.', '6', '.'},
59-
{'8', '.', '.', '.', '6', '.', '.', '.', '3'},
60-
{'4', '.', '.', '8', '.', '3', '.', '.', '1'},
61-
{'7', '.', '.', '.', '2', '.', '.', '.', '6'},
62-
{'.', '6', '.', '.', '.', '.', '2', '8', '.'},
63-
{'.', '.', '.', '4', '1', '9', '.', '.', '5'},
64-
{'.', '.', '.', '.', '8', '.', '.', '7', '9'},
65-
};
54+
board =
55+
new char[][] {
56+
{'8', '3', '.', '.', '7', '.', '.', '.', '.'},
57+
{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
58+
{'.', '9', '8', '.', '.', '.', '.', '6', '.'},
59+
{'8', '.', '.', '.', '6', '.', '.', '.', '3'},
60+
{'4', '.', '.', '8', '.', '3', '.', '.', '1'},
61+
{'7', '.', '.', '.', '2', '.', '.', '.', '6'},
62+
{'.', '6', '.', '.', '.', '.', '2', '8', '.'},
63+
{'.', '.', '.', '4', '1', '9', '.', '.', '5'},
64+
{'.', '.', '.', '.', '8', '.', '.', '7', '9'},
65+
};
6666
assertFalse(ValidSudoku.solution2(board));
6767
}
68-
}
68+
}

0 commit comments

Comments
 (0)