Skip to content

Commit ed4cc45

Browse files
committed
add: leetcode 0495 test
1 parent d7f2304 commit ed4cc45

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package leetcode
2+
3+
import (
4+
"fmt"
5+
"testing"
6+
)
7+
8+
type question495 struct {
9+
para495
10+
ans495
11+
}
12+
13+
// para 是参数
14+
type para495 struct {
15+
timeSeries []int
16+
duration int
17+
}
18+
19+
// ans 是答案
20+
type ans495 struct {
21+
ans int
22+
}
23+
24+
func Test_Problem495(t *testing.T) {
25+
26+
qs := []question495{
27+
28+
{
29+
para495{[]int{1, 4}, 2},
30+
ans495{4},
31+
},
32+
33+
{
34+
para495{[]int{1, 2}, 2},
35+
ans495{3},
36+
},
37+
}
38+
39+
fmt.Printf("------------------------Leetcode Problem 495------------------------\n")
40+
41+
for _, q := range qs {
42+
_, p := q.ans495, q.para495
43+
fmt.Printf("【input】:%v 【output】:%v\n", p, findPoisonedDuration(p.timeSeries, p.duration))
44+
}
45+
fmt.Printf("\n\n\n")
46+
}

0 commit comments

Comments
 (0)