Write a function that takes a string as input and returns the string reversed.
Example: Given s = “hello”, return “olleh”.
class Solution {public: string reverseString(string s) { string t; for(int i = s.length() - 1; i >= 0; --i){ t.push_back(s[i]); } return t; }};新闻热点
疑难解答