[BFS] Lengthy,but easy to understand Double Queue Implementaion [JAVA]
\npublic static int maxLevelSum(TreeNode root) {\n        Queue<Queue<TreeNode>> q = new LinkedList<>();\n        int max = Integer.MIN_VALUE;\n        int leve
```\npublic static int maxLevelSum(TreeNode root) {\n        Queue<Queue<TreeNode>> q = new LinkedList<>();\n        int max = Integer.MIN_VALUE;\n        int level = 1;\n        int maxLevel = 1;\n        Queue<TreeNode> iq = new LinkedList<>();\n        iq.add(root);\n        q.add(iq);\n        while (!q.isEmpty()) {\n            iq = q.poll();\n            int tempMax = 0;\n            Queue<TreeNode> iq2 = new LinkedList<>();\n            while (iq != null && !iq.isEmpty()) {\n                root = iq.poll();\n                tempMax += root.val;\n                if (root.left != null)\n                    iq2.add(root.left);\n                if (root.right != null)\n                    iq2.add(root.right);\n            }\n            if (max == tempMax) {\n                maxLevel = Math.min(maxLevel, level);\n            } else if (max < tempMax) {\n                max = tempMax;\n                maxLevel = level;\n            }\n            level++;\n            if (iq2.size() > 0)\n                q.add(iq2);\n        }\n        return maxLevel;\n    }\n\n```
['Breadth-First Search', 'Queue', 'Java']