c++ bfs
standard queue level order traversal.\n\ntmp_sum records sum of current level, global_sum records largest level sum so far.\n\nIf tmp_sum > global_sum, it means
standard queue level order traversal.\n\n```tmp_sum``` records sum of current level, ```global_sum``` records largest level sum so far.\n\nIf ```tmp_sum > global_sum```, it means sum of current level is large, assign current ```level``` to ```res```.\n\n```\nclass Solution {\npublic:\n    int maxLevelSum(TreeNode* root) {\n        if (root == NULL) return 0;\n        int res = 0, level = 0, global_sum = 0;\n        queue<TreeNode*> q;\n        q.push(root);\n        while (!q.empty()) {\n            int count = q.size(), tmp_sum = 0;\n            while (count--) {\n                TreeNode* tmp = q.front();\n                q.pop();\n                tmp_sum += tmp->val;\n                if (tmp->left) q.push(tmp->left);\n                if (tmp->right) q.push(tmp->right);\n            }\n            level++;\n            if (tmp_sum > global_sum) res = level;\n            global_sum = max(tmp_sum, global_sum);\n        }\n        return res;\n    }\n};\n```
[]