class Solution:
def isSymmetrical(self, pRoot):
if pRoot == None:
return True
return self.helper(pRoot, pRoot)
def helper(self, p1, p2):
if p1 == None and p2 == None:
return True
if p1 == None or p2 == None:
return False
if p1.val != p2.val:
return False
else:
return self.helper(p1.left,p2.right) and self.helper(p1.right,p2.left)
网友评论