跳转至

344.反转字符串

1
2
3
4
5
6
7
8
9
class Solution {
    public void reverseString(char[] s) {
        for(int i = 0, j = s.length -1;i < j ; i++ ,j--){
            char c = s[i];
            s[i] = s[j];
            s[j] = c;
        }
    }
}