Thinking process
Two pointers, one starts from the beginning, one starts from the end, then moving to center
Don't need to worry about skip white spaces or any other special characters
public class Solution {
public String reverseString(String s) {
char[] chars = s.toCharArray();
int left = 0;
int right = chars.length - 1;
while (left < right) {
char tmp = chars[left];
chars[left] = chars[right];
chars[right] = tmp;
left++;
right--;
}
return new String(chars);
}
}