Simple recursion


#1

void sum0(TreeNode A,long p,long &sum)
{
if(!A)
return;
if(!(A->left) && !(A->right))
{
p=(p
10+A->val)%1003;
sum=(sum+p)%1003;
return;
}
p=(p10+A->val)%1003;
sum0(A->left,p,sum);
sum0(A->right,p,sum);
}
int Solution::sumNumbers(TreeNode
A)
{
long sum=0;
long p=0;
sum0(A,p,sum);
return sum;
}