**What's wrong with this code?**


#1

void sumToLeaf(TreeNode *a, vector &st, string str)
{
if(!a) return;
str.append(to_string(a->val));
if(!a->left && !a->right)
{
st.push_back(str);
return;
}

if(a->left)
     sumToLeaf(a->left, st, str);

if(a->right)
     sumToLeaf(a->right, st, str);

}

int Solution::sumNumbers(TreeNode* A) {
vectorst;
sumToLeaf(A, st, “”);
long long res = 0;
while(!st.empty())
{
res += std::stoll(st.back());
//cout<<st.back()<<endl;
st.pop_back();
}

return res%1003;

}


#2

string length can be of length 18 or more which can overflow.