给定一棵二叉树,返回齐自底向上的层序遍历。
数据范围:二叉树上节点数满足
,二叉树上的值满足 
样例图:
class Solution: def levelOrderBottom(self , root: TreeNode) -> List[List[int]]: # write code here q=[root] all_res=[] while q: size=len(q) res=[] while size>0: cur=q.pop(0) res.append(cur.val) if cur.left: q.append(cur.left) if cur.right: q.append(cur.right) size-=1 all_res.append(res) return all_res[::-1]