###### YuqiRealm.com

SUDO -U 更多内容请见：https://github.com/EmilyQiRabbit

###### [leetcode]129. Sum Root to Leaf Numbers -- JavaScript 代码
/**
* Definition for a binary tree node.
* function TreeNode(val) {
*     this.val = val;
*     this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @return {number}
*/
var sumNumbers = function(root) {
if(root === null){
return 0;
}
var totalSum = 0;
findNum(root,0);

function findNum(node,curSum){
curSum = node.val + curSum*10;
var left = node.left;
var right = node.right;
if(left === null && right === null){
totalSum += curSum;
return;
}
if(left !== null){
findNum(node.left,curSum);
}
if(right !== null){
findNum(node.right,curSum);
}
}
};

#### LeetCode(129)SumRoottoLeafNumbers

2014-02-28 15:57:49

#### Sum Root to Leaf Numbers -- LeetCode

2014-04-04 09:20:44

#### 【LeetCode-面试算法经典-Java实现】【129-Sum Root to Leaf Numbers（所有根到叶子结点组组成的数字相加）】

2015-08-15 06:11:18

#### LeetCode 129:Sum Root to Leaf Numbers

2015-12-31 14:30:09

#### leetcode 129. Sum Root to Leaf Numbers-根到叶子之和|bfs|dfs|递归|非递归

2016-06-05 13:21:50

#### leetcode Sum Root to Leaf Numbers 详细思考分析过程

2013-11-03 09:15:06

#### 129. Sum Root to Leaf Numbers--注意非递归的方法

2017-01-15 21:54:42

#### 二叉树遍历129. Sum Root to Leaf Numbers

2016-11-04 18:27:25

#### 129. Sum Root to Leaf Numbers**

2016-12-24 15:13:04

#### 129. Sum Root to Leaf Numbers

2015-08-14 21:06:34

## 不良信息举报

[leetcode]129. Sum Root to Leaf Numbers -- JavaScript 代码