mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-06 09:23:19 +08:00
48 lines
719 B
Go
48 lines
719 B
Go
package leetcode
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
type question216 struct {
|
|
para216
|
|
ans216
|
|
}
|
|
|
|
// para 是参数
|
|
// one 代表第一个参数
|
|
type para216 struct {
|
|
n int
|
|
k int
|
|
}
|
|
|
|
// ans 是答案
|
|
// one 代表第一个答案
|
|
type ans216 struct {
|
|
one [][]int
|
|
}
|
|
|
|
func Test_Problem216(t *testing.T) {
|
|
|
|
qs := []question216{
|
|
|
|
{
|
|
para216{3, 7},
|
|
ans216{[][]int{{1, 2, 4}}},
|
|
},
|
|
{
|
|
para216{3, 9},
|
|
ans216{[][]int{{1, 2, 6}, {1, 3, 5}, {2, 3, 4}}},
|
|
},
|
|
}
|
|
|
|
fmt.Printf("------------------------Leetcode Problem 216------------------------\n")
|
|
|
|
for _, q := range qs {
|
|
_, p := q.ans216, q.para216
|
|
fmt.Printf("【input】:%v 【output】:%v\n", p, combinationSum3(p.n, p.k))
|
|
}
|
|
fmt.Printf("\n\n\n")
|
|
}
|