BFS || C++
Code\n\nclass Solution {\npublic:\n    int maxLevelSum(TreeNode* root) {\n        queue<TreeNode*> q;\n        TreeNode* node;\n        int n,s=0,x=1,y=INT_MIN,
# Code\n```\nclass Solution {\npublic:\n    int maxLevelSum(TreeNode* root) {\n        queue<TreeNode*> q;\n        TreeNode* node;\n        int n,s=0,x=1,y=INT_MIN,z;\n        q.push(root);\n        while(!q.empty()){\n            n = q.size();\n            s = 0;\n            while(n--){\n                node = q.front();q.pop();\n                s += node->val;\n                if(node->left)q.push(node->left);\n                if(node->right)q.push(node->right);\n            }\n            if(s>y){\n                y = s;\n                z = x;\n            }\n            x++;\n        }\n        return z;\n    }\n};\n```
['Tree', 'Breadth-First Search', 'Binary Tree', 'C++']