344. 反转字符串
题目
代码
class Solution {
public:
string reverseString(string s) {
for (int i=0,j=s.size()-1; i<=j; i++, j--)
{
std::swap(s[i],s[j]);
}
return s;
}
};
https://github.com/li-zheng-hao
class Solution {
public:
string reverseString(string s) {
for (int i=0,j=s.size()-1; i<=j; i++, j--)
{
std::swap(s[i],s[j]);
}
return s;
}
};