学习题解 重拳出击 喵喵喵
class Solution {
public int sumNumbers(TreeNode root) {
return bt(root, 0);
}
public int bt(TreeNode root, int tag){
if(root == null) return 0;
int tmp = tag * 10 + root.val;
if(root.left == null && root.right == null){
return tmp;
}
return bt(root.left, tmp) + bt(root.right, tmp);
}
}



