递归
class Solution(object):
def isSymmetric(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
if not root:
return True
def recure(left,right):
if not left and not right:
return True
if not left or not right or left.val != right.val:
return False
return recure(left.left,right.right) and recure(left.right,right.left)
return recure(root.left,root.right)