Simple Level Order Traversal || Clean Code :)
\n\n# Code\n\nclass Solution {\n    public int maxLevelSum(TreeNode root) {\n        Queue<TreeNode> q = new LinkedList<>();\n        int level =1;\n        int
\n\n# Code\n```\nclass Solution {\n    public int maxLevelSum(TreeNode root) {\n        Queue<TreeNode> q = new LinkedList<>();\n        int level =1;\n        int ans = 1;\n        int sum = Integer.MIN_VALUE;\n        q.offer(root);\n        while(!q.isEmpty()){\n            int currSum = 0;\n            int size =q.size();\n            while(size-- >0){\n                TreeNode polled = q.poll();\n                currSum += polled.val;\n                if(polled.left != null){\n                    q.offer(polled.left);\n                }\n                if(polled.right != null){\n                    q.offer(polled.right);\n                }\n            } \n            if(currSum > sum){\n                sum = currSum;\n                ans = level;\n            }\n            level++;\n        }\n        return ans;\n    }\n}\n```
['Java']