C++ Simple Solution || Easy to Understand || BFS
Intuition\nBFS : level wie traversal\n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time complexity: O(n)\nwhere n is no. of
# Intuition\nBFS : level wie traversal\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n)\nwhere n is no. of nodes\n\n- Space complexity: O(n)\nwhere n is no. of nodes\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        q.push(root);\n        int currlevel = 1;\n        int maxsum = -1e9;\n        int level = 0;\n        while(!q.empty()){\n            int n = q.size();\n            int sum = 0;\n            while(n--){\n             TreeNode* temp = q.front();\n             sum += temp->val;\n             q.pop();\n             if(temp->left != NULL){\n                 q.push(temp->left);\n             }\n              if(temp->right != NULL){\n                 q.push(temp->right);\n             }\n            }\n            if(sum> maxsum){\n                maxsum = sum;\n                level = currlevel;\n            }\n            currlevel++;\n        }\n        return level;\n    }\n};\n```
['Breadth-First Search', 'Binary Tree', 'C++']