题目比较简单
class Solution { public: /** * 反转字符串 * @param str string字符串 * @return string字符串 */ string solve(string str) { // write code here int i = str.length() - 1; int j = 0; while(i>j) swap(str[i--], str[j++]); return str; } };
题目比较简单
class Solution { public: /** * 反转字符串 * @param str string字符串 * @return string字符串 */ string solve(string str) { // write code here int i = str.length() - 1; int j = 0; while(i>j) swap(str[i--], str[j++]); return str; } };