Maximum level sum of a binary tree
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n![image.png](https://assets.leetcode.com/users/images/2244483b-89a6-4887-bec8-547f912c722f_1689914058.2421546.png)\n\n# 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        l=defaultdict(list)\n        def dfs(root,h):\n            if root is None:\n                return\n            l[h].append(root.val)\n            dfs(root.left,h+1)\n            dfs(root.right,h+1)\n        dfs(root,1)\n        res=[]\n        for i in l.values():\n            res.append(sum(i))\n        return res.index(max(res))+1\n\n```
['Python3']