(一)题目描述
(二)思想方法
定义两个下表指针low,high从数组两边交换。直到low大于high
(三)代码实现
class Solution {
public:
void reverseString(vector<char>& s) {
int low = 0, high= s.size()-1;
char temp;
while (low <= high)
{
temp = s[high];
s[high] = s[low];
s[low] = temp;
low++;
high--;
}
}
};