标签:bottom print class scribe sub write sel range highlight
# -*- coding:utf-8 -*- # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # 返回二维列表[[1,2],[4,5]] def Print(self, pRoot): # write code here if not pRoot: return [] queue = [] l = [] queue.append(pRoot) while queue: size = len(queue) row = [] for i in queue: row.append(i.val) l.append(row) for i in range(size): node = queue.pop(0) if node.left: queue.append(node.left) if node.right: queue.append(node.right) return l
标签:bottom print class scribe sub write sel range highlight
原文地址:https://www.cnblogs.com/tianqizhi/p/9690203.html