16. leetcode 404. Sum of Left Leaves

mac2022-06-30  76

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.

思路:还是递归。仔细看代码,体会递归的设计方法。

 

转载于:https://www.cnblogs.com/vincent93/p/6686533.html

最新回复(0)