@@ -0,0 +1,1030 @@
+# Definition for a binary tree node.%0A# class TreeNode:%0A#     def __init__(self, val=0, left=None, right=None):%0A#         self.val = val%0A#         self.left = left%0A#         self.right = right%0Aclass Solution:%0A    def recursiveDeepestLeavesSum(self, node: TreeNode, currLevel: int):%0A        if node is None:%0A            return%0A        if node.left is None and node.right is None:%0A            if currLevel %3E self.deepestLevel:%0A                self.deepestSum = node.val%0A            elif currLevel == self.deepestLevel:%0A                self.deepestSum += node.val%0A            self.deepestLevel = max(self.deepestLevel, currLevel)%0A            if currLevel %3E self.deepestLevel: # shallow leaf%0A                return%0A        self.recursiveDeepestLeavesSum(node.left, currLevel+1)%0A        self.recursiveDeepestLeavesSum(node.right, currLevel+1)%0A%0A    def deepestLeavesSum(self, root: TreeNode) -%3E int:%0A        self.deepestLevel = 0%0A        self.deepestSum = 0%0A        self.recursiveDeepestLeavesSum(root, 0)%0A        return self.deepestSum%0A

1302. Deepest Leaves Sum