16. leetcode 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.

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

 

posted @ 2017-04-09 21:33  蓦然闻声  阅读(59)  评论(0编辑  收藏  举报