> For the complete documentation index, see [llms.txt](https://r24zeng.gitbook.io/leetcode-notebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://r24zeng.gitbook.io/leetcode-notebook/wan-quan-an-zhao-jiu-zhang-suan-fa-shua-de-60-dao-zuo-you/iii.-binary-tree/107.-binary-tree-level-order-traversal-ii.md).

# 107. Binary Tree Level Order Traversal II

\# Easy, BFS

{% hint style="info" %}
add reverse after #102
{% endhint %}

```java
class Solution {
    public List<List<Integer>> levelOrderBottom(TreeNode root) {
        List<List<Integer>> res = new ArrayList<List<Integer>>();
        if(root == null) return res;
        
        int level = 0;
        Queue<TreeNode> queue = new LinkedList<TreeNode>();
        queue.add(root);
        
        while(!queue.isEmpty()) {
            int l = queue.size();
            res.add(new ArrayList<Integer>());
            for(int i = 0; i < l; i ++) {
                TreeNode node = queue.poll();
                res.get(level).add(node.val);
                if(node.left != null) queue.add(node.left);
                if(node.right != null) queue.add(node.right);
            }
            level ++;
        }
            
        return Collections.reverse(res);
        return res;
    }
}
```
