mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-05 16:36:41 +08:00
Add solution 0097、0523、0525、1465、1744
This commit is contained in:
@ -0,0 +1,53 @@
|
||||
package leetcode
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type question523 struct {
|
||||
para523
|
||||
ans523
|
||||
}
|
||||
|
||||
// para 是参数
|
||||
// one 代表第一个参数
|
||||
type para523 struct {
|
||||
nums []int
|
||||
k int
|
||||
}
|
||||
|
||||
// ans 是答案
|
||||
// one 代表第一个答案
|
||||
type ans523 struct {
|
||||
one bool
|
||||
}
|
||||
|
||||
func Test_Problem523(t *testing.T) {
|
||||
|
||||
qs := []question523{
|
||||
|
||||
{
|
||||
para523{[]int{23, 2, 4, 6, 7}, 6},
|
||||
ans523{true},
|
||||
},
|
||||
|
||||
{
|
||||
para523{[]int{23, 2, 6, 4, 7}, 6},
|
||||
ans523{true},
|
||||
},
|
||||
|
||||
{
|
||||
para523{[]int{23, 2, 6, 4, 7}, 13},
|
||||
ans523{false},
|
||||
},
|
||||
}
|
||||
|
||||
fmt.Printf("------------------------Leetcode Problem 523------------------------\n")
|
||||
|
||||
for _, q := range qs {
|
||||
_, p := q.ans523, q.para523
|
||||
fmt.Printf("【input】:%v 【output】:%v\n", p, checkSubarraySum(p.nums, p.k))
|
||||
}
|
||||
fmt.Printf("\n\n\n")
|
||||
}
|
Reference in New Issue
Block a user