Sum of Left Leaves
Easy
Topics
Given the root of a binary tree, return the sum of all left leaves — leaf nodes that are the left child of their parent.
Example 1
Input: root = [3,9,20,null,null,15,7] Output: 24 Explanation: Left leaves are 9 and 15; 9 + 15 = 24.
Example 2
Input: root = [1] Output: 0
Constraints
- 1 <= number of nodes <= 1000
- -1000 <= Node.val <= 1000
Run ⌘' · Submit ⌘⏎