344、反转字符串
基本思想:
双指针中的左右指针
具体实现:
代码:
class Solution {
public void reverseString(char[] s) {
for (int i = 0, j = s.length - 1; i < j; i++, j--){
char temp = s[i];
s[i] = s[j];
s[j] = temp;
}
}
}
标签:344,char,temp,反转,力扣,字符串,指针
来源: https://www.cnblogs.com/zhaojiayu/p/15399442.html