1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
def (self, root: TreeNode) -> int: if root is None: return 0 xx = 1 queue = [root] while queue: cache = [] for q in queue: if q.left is None and q.right is None: pass if q.left is not None: cache.append(q.left) if q.right is not None: cache.append(q.right) xx += 1 queue = cache
|
近期评论