criskgl
10/6/2019 - 8:56 AM

reverse IN PLACE char array

public void reverseString(char[] s) {
    int left = 0;
    int right = s.length - 1;
    while(left < s.length/2){
        char temp = s[left];
        s[left] = s[right];
        s[right] = temp;
        left++;
        right--;
    }
}