Java Clean and Concise using a Queue
public List<List<Integer>> levelOrder(TreeNode root) {\n        List<List<Integer>> result = new ArrayList<List<Integer>>();\n        if(root==null) return resu
    public List<List<Integer>> levelOrder(TreeNode root) {\n        List<List<Integer>> result = new ArrayList<List<Integer>>();\n        if(root==null) return result;\n        Queue<TreeNode> q = new LinkedList<>();\n        q.add(root);\n        while(q.size()>0){\n            List<Integer> list = new ArrayList<>();\n            int size = q.size();\n            for(int i=0; i<size; i++){\n                TreeNode node = q.poll();\n                list.add(node.val);\n                if(node.left!=null) q.add(node.left);\n                if(node.right!=null) q.add(node.right);\n            }\n            result.add(list);\n        }\n        return result;\n    }
[]