faster than 98.56% of C++ || Simple BFS || level order traversal
\n//plese upvote if you found it useful\n//comment below if you know any other approach to solve this problem\n//level order traversal and return the level with
```\n//plese upvote if you found it useful\n//comment below if you know any other approach to solve this problem\n//level order traversal and return the level with max sum\n\n\nclass Solution {\npublic:\n    int maxLevelSum(TreeNode* root) {\n      if(root==NULL) return 0;\n      int m=INT_MIN;\n     int f=0,i=0;\n      queue<TreeNode*>q;\n      q.push(root);\n      while(!q.empty()){\n          int n=q.size();\n          int s=0;\n          for(int i=0;i<n;i++){\n              TreeNode*tmp=q.front();\n              q.pop();\n              s+=tmp->val;\n              if(tmp->left!=NULL)\n                  q.push(tmp->left);\n              if(tmp->right!=NULL)\n                  q.push(tmp->right);\n          }\n          i++;\n          if(m<s){\n             m=s;\n              f=i;\n          }\n      }\n        return f;\n    }\n};\n```
['Breadth-First Search', 'C', 'C++']