标签:树的镜像 esc iss bsp 二叉树 pytho div def 二叉树的镜像
1 class Solution: 2 def isSymmetrical(self, pRoot): 3 # write code here 4 def mirror(left,right): 5 if left == None and right == None: 6 return True 7 elif left == None or right == None: 8 return False 9 if left.val != right.val: 10 return False 11 ret1 = mirror(left.left,right.right) 12 ret2 = mirror(left.right,right.left) 13 return ret1 and ret2 14 if pRoot == None: 15 return True 16 return mirror(pRoot.left,pRoot.right)
2020-01-01 09:32:41
标签:树的镜像 esc iss bsp 二叉树 pytho div def 二叉树的镜像
原文地址:https://www.cnblogs.com/NPC-assange/p/12128291.html