LeetCode——Reverse String

Question

Write a function that takes a string as input and returns the string reversed.

Example:

Given s = "hello", return "olleh".

Answer

class Solution {
public:
string reverseString(string s) {
string str(s.rbegin(), s.rend());
return str;
}
};
05-06 17:36