-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
/
Copy path37. Sudoku Solver_test.go
62 lines (53 loc) · 1.51 KB
/
37. Sudoku Solver_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package leetcode
import (
"fmt"
"testing"
)
type question37 struct {
para37
ans37
}
// para 是参数
// one 代表第一个参数
type para37 struct {
s [][]byte
}
// ans 是答案
// one 代表第一个答案
type ans37 struct {
s [][]byte
}
func Test_Problem37(t *testing.T) {
qs := []question37{
{
para37{[][]byte{
{'5', '3', '.', '.', '7', '.', '.', '.', '.'},
{'6', '.', '.', '1', '9', '5', '.', '.', '.'},
{'.', '9', '8', '.', '.', '.', '.', '6', '.'},
{'8', '.', '.', '.', '6', '.', '.', '.', '3'},
{'4', '.', '.', '8', '.', '3', '.', '.', '1'},
{'7', '.', '.', '.', '2', '.', '.', '.', '6'},
{'.', '6', '.', '.', '.', '.', '2', '8', '.'},
{'.', '.', '.', '4', '1', '9', '.', '.', '5'},
{'.', '.', '.', '.', '8', '.', '.', '7', '9'}}},
ans37{[][]byte{
{'5', '3', '4', '6', '7', '8', '9', '1', '2'},
{'6', '7', '2', '1', '9', '5', '3', '4', '8'},
{'1', '9', '8', '3', '4', '2', '5', '6', '7'},
{'8', '5', '9', '7', '6', '1', '4', '2', '3'},
{'4', '2', '6', '8', '5', '3', '7', '9', '1'},
{'7', '1', '3', '9', '2', '4', '8', '5', '6'},
{'9', '6', '1', '5', '3', '7', '2', '8', '4'},
{'2', '8', '7', '4', '1', '9', '6', '3', '5'},
{'3', '4', '5', '2', '8', '6', '1', '7', '9'}}},
},
}
fmt.Printf("------------------------Leetcode Problem 37------------------------\n")
for _, q := range qs {
_, p := q.ans37, q.para37
fmt.Printf("【input】:%v \n\n", p)
solveSudoku(p.s)
fmt.Printf("【output】:%v \n\n", p)
}
fmt.Printf("\n\n\n")
}