Sum of Left Leaves
Given the root of a binary tree, return the sum of all left leaves. A leaf is a node with no children. A left leaf is a leaf that is the left child of another node.

30:00

Sum of Left Leaves
easy
Topics
Companies

Given the root of a binary tree, return the sum of all left leaves. A leaf is a node with no children. A left leaf is a leaf that is the left child of another node.

Example 1:
Input: [3,9,20,null,null,15,7]
Output: 24
Constraints:
  • The number of nodes is in the range [1,1000][1, 1000].

  • 1000Node.val1000-1000 \leq \text{Node.val} \leq 1000

Input
arr =[3,9,20,null,null,15,7]

Find sum of all left leaves in the tree

Sum: 0
Current Node
Left Leaf
Visited
Binary Tree

3

9

L

20

15

L

7

Left Leaves Found

None yet

Sum of Left Leaves: 0

Variables
No variables to display
DepthFunction Call
Stack empty
0/8