[JAVA] Iterative solution easy to understand
\nclass Solution {\n    public List<List<Integer>> levelOrder(TreeNode root) {\n      Queue <TreeNode> q = new LinkedList <TreeNode>();\n      List<List<Integer
```\nclass Solution {\n    public List<List<Integer>> levelOrder(TreeNode root) {\n      Queue <TreeNode> q = new LinkedList <TreeNode>();\n      List<List<Integer>> list = new LinkedList <List<Integer>>();\n      if(root == null)\n        return list;\n      \n      q.offer(root);\n      while(!q.isEmpty()) {\n        int num = q.size();\n        List<Integer> subList = new LinkedList<Integer>();\n        for(int i = 0; i < num; i ++) {\n          if(q.peek().left != null)\n            q.offer(q.peek().left);\n           if(q.peek().right != null)\n            q.offer(q.peek().right);\n          subList.add(q.poll().val);\n        }\n        list.add(subList);\n      }\n      return list;\n    }\n}\n```\n# PLEASE UPVOTE IF IT WAS HELPFULL
['Queue', 'Binary Tree', 'Iterator', 'Java']