Lipsky

# LeetCode 404. Sum of Left Leaves 左叶子结点值之和

2020/02/20 Share

#### 404. Sum of Left Leaves 左叶子结点值之和#

Find the sum of all left leaves in a given binary tree.

### Example:#

3


/ \
9 20
/ \
15 7

There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24.

### Resolution#

Time Complexity: $O(n)$

Space Complexity: $O(h)$

note：recursion

The algrithm above is based on how to sum value of all nodes.