力扣题目链接
位运算
class Solution {
public void reverseString(char[] s) {
int l = 0;
int r = s.length - 1;
while(l<r){
s[l] ^= s[r];//s[l] = a^b
s[r] ^= s[l];//s[r] = b^a^b = a;
s[l] ^= s[r];//s[l] = a^b^a = b;
l++;
r--;
}
}
}