Maximum Level Sum of a Binary Tree C++ solution
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:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int maxLevelSum(TreeNode* root) \n    {\n        int maxsum=INT_MIN,levelctr=1,ans;\n        queue<TreeNode*> q;\n        q.push(root);\n        while(!q.empty())\n        {\n            int ls=0,n=q.size();\n            for(int i=0;i<n;i++)\n            {\n                TreeNode* node=q.front();\n                q.pop();\n                if(node->left) q.push(node->left);\n                if(node->right) q.push(node->right);\n                ls+=node->val;\n            }\n            if(ls>maxsum)\n            {\n                maxsum=max(maxsum,ls);\n                ans=levelctr;\n            }\n            levelctr++;\n        }\n        return ans;\n    }\n};\n```
['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree', 'C++']