class Solution {
public:
string reverseString(string s) {
string strReverse = s;
for(int n = s.size()-1; n >= 0 ; n--)
{
strReverse[s.size() - 1 - n] = s[n];
}
strReverse[s.size()] = '\0';
return strReverse;
}
};
344.Reverse String
最新推荐文章于 2024-08-20 10:34:34 发布