标签:列表 ott return solution write div append int bottom
class Solution: # 返回从上到下每个节点值列表,例:[1,2,3] def PrintFromTopToBottom(self, root): # write code here queen=[] res=[] if root is not None: queen.append(root) while len(queen) is not 0: temp=queen.pop(0) res.append(temp.val) if temp.left is not None: queen.append(temp.left) if temp.right is not None: queen.append(temp.right) return res
标签:列表 ott return solution write div append int bottom
原文地址:https://www.cnblogs.com/zhaiyansheng/p/10415403.html