From 8f0652d11686e1c3ad926af461ef83edb9d61768 Mon Sep 17 00:00:00 2001 From: songjiayang Date: Tue, 15 Sep 2020 17:31:37 +0800 Subject: [PATCH] Update problem018.go --- .../problem018.go" | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git "a/018-\346\240\221\347\232\204\345\255\220\347\273\223\346\236\204/problem018.go" "b/018-\346\240\221\347\232\204\345\255\220\347\273\223\346\236\204/problem018.go" index 8152d74..ddb1dc2 100644 --- "a/018-\346\240\221\347\232\204\345\255\220\347\273\223\346\236\204/problem018.go" +++ "b/018-\346\240\221\347\232\204\345\255\220\347\273\223\346\236\204/problem018.go" @@ -30,7 +30,7 @@ func hasSub(p *TreeNode, c *TreeNode) bool { if p == nil { return false } if p.Val != c.Val { - return true + return false } return hasSub(p.Left, c.Left) && hasSub(p.Right, c.Right) @@ -44,7 +44,4 @@ func main() { sub3 := &TreeNode{2, nil, nil} fmt.Println(hasSubRootOrTree(root, sub1), hasSubRootOrTree(root, sub2), hasSubRootOrTree(root, sub3)) - - - }