344.反转字符串
双指针
class Solution {
public void reverseString(char[] s) {
int first = 0, last = s.length - 1;
while(first < last){
char temp = s[first];
s[first] = s[last];
s[last] = temp;
first++;
last--;
}
}
}
- 反转字符串II
剑指Offer 05.替换空格
151.翻转字符串里的单词
剑指Offer58-II.左旋转字符串’
翻转再翻转就回到原先的了,改变的只是位置