leetcode 344. Reverse String
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 ans=""; int n=s.length(); for(int i=n-1;i>=0;i--){ ans+=s[i]; } return ans; } };