/** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */ funcmirrorTree(root *TreeNode) *TreeNode { if root == nil{ returnnil } left := mirrorTree(root.Left) right := mirrorTree(root.Right)
/** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */ funcisSubStructure(A *TreeNode, B *TreeNode)bool { if B==nil || A==nil{ returnfalse } if A.Val==B.Val && judge(A,B){ returntrue }