Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 459 Bytes

File metadata and controls

21 lines (16 loc) · 459 Bytes

Screen Shot 2023-02-24 at 6 15 57 PM

/**
 * @param {character[]} s
 * @return {void} Do not return anything, modify s in-place instead.
 */
var reverseString = function(s) {
    let i = 0, j = s.length - 1;
    while(i < j) {
        [s[i], s[j]] = [s[j], s[i]];
        i++;
        j--;
    }
    return s;
};