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.
DFS:https://leetcode.com/problems/sum-of-left-leaves/discuss/88950
BFS:https://leetcode.com/problems/sum-of-left-leaves/discuss/89060
Solution:
思路:
Time Complexity: O(N) Space Complexity: O(N)
Solution Code: