LeetCode/string/ReverseString.java
// the input array in-place with O(1) extra memory.
the input array in-place with O(1) extra memory.
the input array in - place with O ( 1 ) extra memory .
public void reverseStringBF(char[] s) {
        char temp;
        for (int i = 0; i < s.length / 2; i++) {
            temp = s[s.length - 1 - i];
            s[s.length - 1 - i] = s[i];
            s[i] = temp;
        }
        System.out.println(s);
    }
public void reverseStringBF ( char [ ] s ) { char temp ; for ( int i = 0 ; i < s . length / 2 ; i ++ ) { temp = s [ s . length - 1 - i ] ; s [ s . length - 1 - i ] = s [ i ] ; s [ i ] = temp ; } System . out . println ( s ) ; }
the input array in-place with O(1) extra memory.
the input array in - place with O ( 1 ) extra memory .