mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-05 00:25:22 +08:00
58 lines
771 B
Go
58 lines
771 B
Go
package leetcode
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
type question414 struct {
|
|
para414
|
|
ans414
|
|
}
|
|
|
|
// para 是参数
|
|
// one 代表第一个参数
|
|
type para414 struct {
|
|
one []int
|
|
}
|
|
|
|
// ans 是答案
|
|
// one 代表第一个答案
|
|
type ans414 struct {
|
|
one int
|
|
}
|
|
|
|
func Test_Problem414(t *testing.T) {
|
|
|
|
qs := []question414{
|
|
|
|
{
|
|
para414{[]int{1, 1, 2}},
|
|
ans414{2},
|
|
},
|
|
|
|
{
|
|
para414{[]int{3, 2, 1}},
|
|
ans414{1},
|
|
},
|
|
|
|
{
|
|
para414{[]int{1, 2}},
|
|
ans414{2},
|
|
},
|
|
|
|
{
|
|
para414{[]int{2, 2, 3, 1}},
|
|
ans414{1},
|
|
},
|
|
}
|
|
|
|
fmt.Printf("------------------------Leetcode Problem 414------------------------\n")
|
|
|
|
for _, q := range qs {
|
|
_, p := q.ans414, q.para414
|
|
fmt.Printf("【input】:%v 【output】:%v\n", p, thirdMax(p.one))
|
|
}
|
|
fmt.Printf("\n\n\n")
|
|
}
|