344. Reverse String
https://leetcode.com/problems/reverse-string/
本题大意:实现字符串的翻转。
解题思路:将字符串的字母首尾对调。
代码实现:
1 string reverseString(string s) { 2 int n = s.size(); 3 for(int i = 0; i < n/2; i++) 4 { 5 char tmp = s[i]; 6 s[i] = s[n-i-1]; 7 s[n-i-1] = tmp; 8 } 9 return s; 10 }