leetcood学习笔记-965-单值二叉树
作者:互联网
题目描述;
第一次提交;
class Solution: def isUnivalTree(self, root: TreeNode) -> bool: if root == None: return True if root.left!=None and root.left.val!=root.val: return False if root.right!=None and root.right.val != root.val: return False if self.isUnivalTree(root.left) and self.isUnivalTree(root.right): return True else: return False
标签:965,isUnivalTree,return,val,self,right,二叉树,root,leetcood 来源: https://www.cnblogs.com/oldby/p/10632451.html