# Deepest Leaves Sum (Leetcode 1302)

Problem Link: <https://leetcode.com/problems/deepest-leaves-sum/>

```python
class Solution:

    def deepestLeavesSum(self, root: Optional[TreeNode]) -> int:
    
        q=[root]
        
        while(len(q)>0):
            temp=[]
            
            for i in range(len(q)):
                node=q.pop()
                if(node.left is not None):
                    q.insert(0,node.left)
                if(node.right is not None):
                    q.insert(0,node.right)
                temp.append(node.val)
                
        return sum(temp)
```
