mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-08-01 00:21:48 +08:00
Add solution 1603、1608、1700、1710、1716、1720、1725、1732、1736、1742、1748、1752、1758
This commit is contained in:
@ -0,0 +1,52 @@
|
||||
package leetcode
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type question1748 struct {
|
||||
para1748
|
||||
ans1748
|
||||
}
|
||||
|
||||
// para 是参数
|
||||
// one 代表第一个参数
|
||||
type para1748 struct {
|
||||
nums []int
|
||||
}
|
||||
|
||||
// ans 是答案
|
||||
// one 代表第一个答案
|
||||
type ans1748 struct {
|
||||
one int
|
||||
}
|
||||
|
||||
func Test_Problem1748(t *testing.T) {
|
||||
|
||||
qs := []question1748{
|
||||
|
||||
{
|
||||
para1748{[]int{1, 2, 3, 2}},
|
||||
ans1748{4},
|
||||
},
|
||||
|
||||
{
|
||||
para1748{[]int{1, 1, 1, 1, 1}},
|
||||
ans1748{0},
|
||||
},
|
||||
|
||||
{
|
||||
para1748{[]int{1, 2, 3, 4, 5}},
|
||||
ans1748{15},
|
||||
},
|
||||
}
|
||||
|
||||
fmt.Printf("------------------------Leetcode Problem 1748------------------------\n")
|
||||
|
||||
for _, q := range qs {
|
||||
_, p := q.ans1748, q.para1748
|
||||
fmt.Printf("【input】:%v 【output】:%v\n", p, sumOfUnique(p.nums))
|
||||
}
|
||||
fmt.Printf("\n\n\n")
|
||||
}
|
Reference in New Issue
Block a user