Simple Python Code🐍 || With Explanation✅✅
Intuition\nSince we need to have the level sum, traversing through BFS is the best approach\n\n# Approach\n Describe your approach to solving the problem. \nTra
# Intuition\nSince we need to have the level sum, traversing through BFS is the best approach\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nTraversing in BFS fashion by using the List.\nUsed the recursive approach to reduce variable names.\n\n\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution(object):\n    sum = float(\'-inf\')\n    level = 0\n    def maxLevelSum(self, root):\n        lis = [root] #creating a list containing only the root node\n        self.go(lis, 1)\n        return self.level\n\n    def go(self, lis, curr):\n        if(len(lis)==0): return\n        lvl = []\n        s = 0\n        for node in lis: #traversing through the level\n            if node.left is not None:\n                lvl.append(node.left) #adding the child nodes\n            if node.right is not None:\n                lvl.append(node.right) #adding the child nodes\n\n            s = s + node.val\n        self.go(lvl, (curr + 1))\n\n        if s >= self.sum: #updating the sum and level counter\n            self.sum = s\n            self.level = curr        \n```
['Breadth-First Search', 'Python']