class Solution:
def isCompleteTree(self , root: TreeNode) -> bool:
# write code here
list_temp2=[]#存结点
now=root
while now!=None:
list_temp2.append(now.left)
list_temp2.append(now.right)
if list_temp2:
now=list_temp2.pop(0)
if now==None:
for li in list_temp2:
if li!=None:
return False
else:
now=None
return True



京公网安备 11010502036488号