规范格式

This commit is contained in:
YDZ
2020-08-07 15:50:06 +08:00
parent 854a339abc
commit 4e11f4028a
1438 changed files with 907 additions and 924 deletions

View File

@ -0,0 +1,76 @@
package leetcode
import (
"fmt"
"testing"
"github.com/halfrost/LeetCode-Go/structures"
)
type question101 struct {
para101
ans101
}
// para 是参数
// one 代表第一个参数
type para101 struct {
one []int
}
// ans 是答案
// one 代表第一个答案
type ans101 struct {
one bool
}
func Test_Problem101(t *testing.T) {
qs := []question101{
question101{
para101{[]int{3, 4, 4, 5, structures.NULL, structures.NULL, 5, 6, structures.NULL, structures.NULL, 6}},
ans101{true},
},
question101{
para101{[]int{1, 2, 2, structures.NULL, 3, 3}},
ans101{true},
},
question101{
para101{[]int{}},
ans101{true},
},
question101{
para101{[]int{1}},
ans101{true},
},
question101{
para101{[]int{1, 2, 3}},
ans101{false},
},
question101{
para101{[]int{1, 2, 2, 3, 4, 4, 3}},
ans101{true},
},
question101{
para101{[]int{1, 2, 2, structures.NULL, 3, structures.NULL, 3}},
ans101{false},
},
}
fmt.Printf("------------------------Leetcode Problem 101------------------------\n")
for _, q := range qs {
_, p := q.ans101, q.para101
fmt.Printf("【input】:%v ", p)
rootOne := structures.Ints2TreeNode(p.one)
fmt.Printf("【output】:%v \n", isSymmetric(rootOne))
}
fmt.Printf("\n\n\n")
}