0
点赞
收藏
分享

微信扫一扫

【二叉树-简单】LCP 44. 开幕式焰火

题目
代码
执行用时:52 ms, 在所有 Python3 提交中击败了43.11% 的用户
内存消耗:15.4 MB, 在所有 Python3 提交中击败了43.99% 的用户
通过测试用例:64 / 64

class Solution:
    def visit(self,root):
        if not root:return
        self.cnt.add(root.val)
        self.visit(root.left)
        self.visit(root.right)

    def numColor(self, root: TreeNode) -> int:
        self.cnt=set()
        self.visit(root)
        return len(self.cnt)
举报

相关推荐

0 条评论