100.same tree
题目给定两个tree
判断他们是不是长一样
判断节点一样加递回左右子树
class Solution:
def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool:
if p is not None and q is not None:
return p.val == q.val and self.isSameTree(p.left, q.left) and self.i
sSameTree(p.right, q.right)
elif p is None and q is None:
return True
else:
return False