File tree Expand file tree Collapse file tree 4 files changed +91
-1
lines changed
Expand file tree Collapse file tree 4 files changed +91
-1
lines changed Original file line number Diff line number Diff line change 44
55## 剑指 Offer <a id =" jzof " ></a >
66
7- * [ JZ3.数组中重复的数字] ( jzof/jz3.md )
7+ * [ OF3.数组中重复的数字] ( lcof/of003/README.md )
8+ * [ OF37.序列化二叉树] ( lcof/of037/README.md )
89
910## LeetCode
1011
Original file line number Diff line number Diff line change 1+ # [ OF0.Template Title] [ title ]
2+
3+ > [ !WARNING|style: flat ]
4+ > This problem is temporarily not PR, please submit [ Create Pull Request PR] ( https://github.com/kylesliu/awesome-golang-algorithm )
5+
6+
7+ ## 题目描述
8+ ....
9+
10+ ** 范例 :**
11+
12+ ```
13+ Input: n=1
14+ Output: 1
15+ ```
16+
17+ ## 题意
18+ > ...
19+
20+ ## 题解
21+
22+ ### 思路1
23+ > ...
24+ ``` go
25+ ```
26+
27+ ## 结语
28+
29+ 如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[ awesome-golang-algorithm] [ me ]
30+
31+ [ title ] : https://www.nowcoder.com/practice/c6c7742f5ba7442aada113136ddea0c3/
32+ [ me ] : https://github.com/kylesliu/awesome-golang-algorithm
Original file line number Diff line number Diff line change 1+ package Solution
2+
3+ func Solution (x bool ) bool {
4+ return x
5+ }
Original file line number Diff line number Diff line change 1+ package Solution
2+
3+ import (
4+ "github.com/stretchr/testify/assert"
5+ "reflect"
6+ "runtime"
7+ "testing"
8+ )
9+
10+ // solution func Info
11+ type SolutionFuncType func (bool ) bool
12+
13+ var SolutionFuncList = []SolutionFuncType {
14+ Solution ,
15+ }
16+
17+ // test info struct
18+ type Case struct {
19+ name string
20+ inputs bool
21+ expect bool
22+ }
23+
24+ // test case
25+ var cases = []Case {
26+ {
27+ name : "TestCase 1" ,
28+ inputs : true ,
29+ expect : true ,
30+ },
31+ {
32+ name : "TestCase 2" ,
33+ inputs : false ,
34+ expect : false ,
35+ },
36+ }
37+
38+ // TestSolution Example for solution test cases
39+ func TestSolution (t * testing.T ) {
40+ ast := assert .New (t )
41+
42+ for _ , f := range SolutionFuncList {
43+ for _ , c := range cases {
44+ t .Run (c .name , func (t * testing.T ) {
45+ actual := f (c .inputs )
46+ ast .Equal (c .expect , actual ,
47+ "func: %v case: %v " ,
48+ runtime .FuncForPC (reflect .ValueOf (f ).Pointer ()).Name (), c .name )
49+ })
50+ }
51+ }
52+ }
You can’t perform that action at this time.
0 commit comments