Files
LeetCode-Go/leetcode/0104.Maximum-Depth-of-Binary-Tree/104. Maximum Depth of Binary Tree_test.go
2020-08-27 00:58:22 +08:00

52 lines
812 B
Go

package leetcode
import (
"fmt"
"testing"
"github.com/halfrost/LeetCode-Go/structures"
)
type question104 struct {
para104
ans104
}
// para 是参数
// one 代表第一个参数
type para104 struct {
one []int
}
// ans 是答案
// one 代表第一个答案
type ans104 struct {
one int
}
func Test_Problem104(t *testing.T) {
qs := []question104{
{
para104{[]int{}},
ans104{0},
},
{
para104{[]int{3, 9, 20, structures.NULL, structures.NULL, 15, 7}},
ans104{3},
},
}
fmt.Printf("------------------------Leetcode Problem 104------------------------\n")
for _, q := range qs {
_, p := q.ans104, q.para104
fmt.Printf("【input】:%v ", p)
root := structures.Ints2TreeNode(p.one)
fmt.Printf("【output】:%v \n", maxDepth(root))
}
fmt.Printf("\n\n\n")
}