C++ Easy Solution ✅ || BFS
Code\n\nclass Solution {\npublic:\n    int maxLevelSum(TreeNode* root) {\n        queue<TreeNode*> q;\n        int maxx=INT_MIN,sum=0,count=0,ans;\n        q.pu
# Code\n```\nclass Solution {\npublic:\n    int maxLevelSum(TreeNode* root) {\n        queue<TreeNode*> q;\n        int maxx=INT_MIN,sum=0,count=0,ans;\n        q.push(root);\n        while(!q.empty()){\n            int n=q.size();\n            count++;\n            sum=0;\n            while(n--){\n                TreeNode* node=q.front();\n                q.pop();\n                sum+=node->val;\n                if(node->left)\n                    q.push(node->left);\n                if(node->right)\n                    q.push(node->right);\n            }\n            if(maxx<sum){\n                maxx=sum;\n                ans=count;\n            }\n        }\n        return ans;\n    }\n};\n```\n![9c6f9412-c860-47d6-9a2e-7fcf37ff3321_1686334926.180891.png](https://assets.leetcode.com/users/images/215a753e-fb31-47aa-81f8-bedb9476a157_1704199407.2671003.png)\n
['Tree', 'Breadth-First Search', 'Binary Tree', 'C++']