Python3 Solution
\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.l
\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 helper(self,root,level):\n        if root:\n            self.level[level]+=root.val\n            self.helper(root.left,level+1)\n            self.helper(root.right,level+1)\n\n\n    def maxLevelSum(self, root: Optional[TreeNode]) -> int:\n        self.level=defaultdict(int)\n        self.helper(root,1)\n        return sorted(self.level.items(),key=lambda x:x[1],reverse=True)[0][0]\n```
['Python', 'Python3']