Intuitive BFS Code C++
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * Definition for a binary tree node.\n * struct TreeNode {\n *     int val;\n *     TreeNode *left;\n *     TreeNode *right;\n *     TreeNode() : val(0), left(nullptr), right(nullptr) {}\n *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}\n * };\n */\nclass Solution {\npublic:\n    int maxLevelSum(TreeNode* root) {\n        queue<TreeNode*>q;\n        if(!root)\n        return 0;\n\n        int m=INT_MIN,level=0,max_level=-1;\n        q.push(root);\n        while(!q.empty()){\n            level++;\n            int s=q.size();\n            int cs=0;\n            while(s--){\n                TreeNode* curr=q.front();\n                q.pop();\n\n                cs+=curr->val;\n                if(curr->left)\n                q.push(curr->left);\n                if(curr->right)\n                q.push(curr->right);\n\n            }\n            if(m<cs){\n            max_level=level;\n            m=cs;\n            }\n        }\n        return max_level;\n    }\n};\n```
['Tree', 'Breadth-First Search', 'Binary Tree', 'C++']