1. 题目描述
Write a function that takes a string as input and returns the string reversed.
Example:
Given s = “hello”, return “olleh”.
2. 思路
直接使用标准库reverse函数
3. 代码
class Solution {
public:
string reverseString(string s) {
reverse(s.begin(), s.end());
return s;
}
};