class Solution:
# 返回二维列表[[1,2],[4,5]]
def Print(self, pRoot):
# write code here
if not pRoot:
return []
tree = [pRoot]
result = []
while tree:
subtree = []
row = []
for i in tree:
row.append(i.val)
if i.left:
subtree.append(i.left)
if i.right:
subtree.append(i.right)
result.append(row)
tree = subtree
return result