# LeetCode题库解答与分析——#107. 二叉树的层次遍历 IIBinaryTreeLevelOrderTraversal

    3
/ \
9  20
/  \
15   7


[
[15,7],
[9,20],
[3]
]

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).

For example:
Given binary tree [3,9,20,null,null,15,7],

    3
/ \
9  20
/  \
15   7


return its bottom-up level order traversal as:

[
[15,7],
[9,20],
[3]
]

/**
* Definition for a binary tree node.
* public class TreeNode {
*     int val;
*     TreeNode left;
*     TreeNode right;
*     TreeNode(int x) { val = x; }
* }
*/
class Solution {
public List<List<Integer>> levelOrderBottom(TreeNode root) {
Stack<List<Integer>> visited=new Stack<List<Integer>>();
int row=0,col=0;
if(root!=null){queue.offer(root);}
else{return visited;}
while(!queue.isEmpty()){
int level=queue.size();
for(int i=0;i<level;i++){
if(queue.peek().left!=null){queue.offer(queue.peek().left);}
if(queue.peek().right!=null){queue.offer(queue.peek().right);}
}