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;
}
};