[ Python ] | Simple & Clean Solution using BFS
Code\n\n# Definition for a binary tree node.\n# class TreeNode:\n#     def __init__(self, val=0, left=None, right=None):\n#         self.val = val\n#         se
# Code\n```\n# Definition for a binary tree node.\n# class TreeNode:\n#     def __init__(self, val=0, left=None, right=None):\n#         self.val = val\n#         self.left = left\n#         self.right = right\nclass Solution:\n    def maxLevelSum(self, root: Optional[TreeNode]) -> int:\n        q = [root]\n        maxi = -maxsize\n        ans = 1\n        cnt = 1\n        while q:\n            t = q.copy()\n            q.clear()\n            s = 0\n            for node in t:\n                if node.left:\n                    q.append(node.left)\n                if node.right:\n                    q.append(node.right)\n                s += node.val\n            if s > maxi:\n                maxi = s\n                ans = cnt\n            cnt += 1\n        return ans\n```
['Tree', 'Breadth-First Search', 'Binary Tree', 'Python3']