mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-25 03:11:41 +08:00
60 lines
951 B
Go
60 lines
951 B
Go
package leetcode
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/halfrost/LeetCode-Go/structures"
|
|
)
|
|
|
|
type question1171 struct {
|
|
para1171
|
|
ans1171
|
|
}
|
|
|
|
// para 是参数
|
|
// one 代表第一个参数
|
|
type para1171 struct {
|
|
one []int
|
|
}
|
|
|
|
// ans 是答案
|
|
// one 代表第一个答案
|
|
type ans1171 struct {
|
|
one []int
|
|
}
|
|
|
|
func Test_Problem1171(t *testing.T) {
|
|
|
|
qs := []question1171{
|
|
|
|
{
|
|
para1171{[]int{1, 2, -3, 3, 1}},
|
|
ans1171{[]int{3, 1}},
|
|
},
|
|
|
|
{
|
|
para1171{[]int{1, 2, 3, -3, 4}},
|
|
ans1171{[]int{1, 2, 4}},
|
|
},
|
|
|
|
{
|
|
para1171{[]int{1, 2, 3, -3, -2}},
|
|
ans1171{[]int{1}},
|
|
},
|
|
|
|
{
|
|
para1171{[]int{1, -1}},
|
|
ans1171{[]int{}},
|
|
},
|
|
}
|
|
|
|
fmt.Printf("------------------------Leetcode Problem 1171------------------------\n")
|
|
|
|
for _, q := range qs {
|
|
_, p := q.ans1171, q.para1171
|
|
fmt.Printf("【input】:%v 【output】:%v\n", p, structures.List2Ints(removeZeroSumSublists(structures.Ints2List(p.one))))
|
|
}
|
|
fmt.Printf("\n\n\n")
|
|
}
|