102.Binary Tree Level Order Traversal Posted on 2017-09-24 | In LeetCode Solution 1: acceptedBFS. two queues one queue + one flag node one queue + int size (chosen) 1234567891011121314151617181920212223242526public List<List<Integer>> levelOrder(TreeNode root) { List<List<Integer>> result = new ArrayList<List<Integer>>(); if (root == null) { return result; } Queue<TreeNode> queue = new LinkedList<>(); queue.add(root); while (!queue.isEmpty()) { ArrayList<Integer> list = new ArrayList<>(); int size = queue.size(); for (int i = 0; i < size; i++) { TreeNode node = queue.poll(); list.add(node.val); if (node.left != null) { queue.add(node.left); } if (node.right != null) { queue.add(node.right); } } result.add(list); } return result;}