题目:
Write a function that takes a string as input and returns the string reversed.
Example: Given s = "hello", return "olleh".
思路:
本题使用C++ 标准库函数 reverse即可,详情请戳:点击打开链接
代码:
class Solution {
public:
string reverseString(string s) {
reverse(s.begin(),s.end());
return s;
}
};