class Solution {
    public String reverseString(String s) {
        char[] chars = s.toCharArray();
        int start = 0, end = s.length() - 1;
        while (start < end) {
            swap(chars, start, end);
            start++;
            end--;
        }
        return new String(chars);
    }

    private void swap(char[] chars, int left, int right) {
        char temp = chars[left];
        chars[left] = chars[right];
        chars[right] = temp;
    }

    public static void main(String[] args) {
        String s = "hello";
        System.out.println(new Solution().reverseString(s));
    }
}

@@ -463,148 +463,7 @@
    %7D
-%0A%0A    public static void main(String%5B%5D args) %7B%0A        String s = %22hello%22;%0A        System.out.println(new Solution().reverseString(s));%0A    %7D
 %0A%7D%0A

344. Reverse String