mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-24 19:04:32 +08:00
57 lines
746 B
Go
57 lines
746 B
Go
package leetcode
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
type question921 struct {
|
|
para921
|
|
ans921
|
|
}
|
|
|
|
// para 是参数
|
|
// one 代表第一个参数
|
|
type para921 struct {
|
|
one string
|
|
}
|
|
|
|
// ans 是答案
|
|
// one 代表第一个答案
|
|
type ans921 struct {
|
|
one int
|
|
}
|
|
|
|
func Test_Problem921(t *testing.T) {
|
|
|
|
qs := []question921{
|
|
{
|
|
para921{"())"},
|
|
ans921{1},
|
|
},
|
|
|
|
{
|
|
para921{"((("},
|
|
ans921{3},
|
|
},
|
|
|
|
{
|
|
para921{"()"},
|
|
ans921{0},
|
|
},
|
|
|
|
{
|
|
para921{"()))(("},
|
|
ans921{4},
|
|
},
|
|
}
|
|
|
|
fmt.Printf("------------------------Leetcode Problem 921------------------------\n")
|
|
|
|
for _, q := range qs {
|
|
_, p := q.ans921, q.para921
|
|
fmt.Printf("【input】:%v 【output】:%v\n", p, minAddToMakeValid(p.one))
|
|
}
|
|
fmt.Printf("\n\n\n")
|
|
}
|