class Solution {
public:
string solve(string s, string t) {
string ret;
int count = 0;
int i = s.size()-1;
int j = t.size()-1;
while(i>=0 || j>=0 || count)
{
if(i>=0) count += s[i--] - '0';
if(j>=0) count += t[j--] - '0';
ret.push_back((count%10)+'0');
count /= 10;
}
reverse(ret.begin(),ret.end());
return ret;
}
};

京公网安备 11010502036488号