每条路径代表一个数字,数字是由每个节点的数字组成的。
可以转换为每个节点的数字代表的是它的父节点的数字乘10加此节点的数字
前面的题是到子节点返回它的值到父节点处理,而这个题是传父节点的值到子节点处理。
class Solution {
public int sumNumbers(TreeNode root) {
if(root==null)return 0;
return core(root,0);
}
public int core(TreeNode root,int fVal){