熟练使用STL,妈妈再也不用担心我的学习!
请编写一个函数,其功能是将输入的字符串反转过来。
示例:
输入:s = "hello" 返回:"olleh"
class Solution {
public:
string reverseString(string s) {
string res(s.rbegin(),s.rend());
return res;
}
};
熟练使用STL,妈妈再也不用担心我的学习!
请编写一个函数,其功能是将输入的字符串反转过来。
示例:
输入:s = "hello" 返回:"olleh"
class Solution {
public:
string reverseString(string s) {
string res(s.rbegin(),s.rend());
return res;
}
};