404. Sum of Left Leaves 404.左叶总和

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.

不是计算么,怎么变成recursive。好吧,还是在外面,还是算DC,就是直接拿来计算了。计算题直接拿来计算就行了
“最左边”这个特质就是左边无、右边也无了。好吧,不说我还真看不出来。

都要加到sum上去才行

猜你喜欢

转载自www.cnblogs.com/immiao0319/p/12949015.html