Created
April 5, 2021 14:51
-
-
Save dariodiaz/9f284c1bde26f85b17efbfb53a9121da to your computer and use it in GitHub Desktop.
[Reverse String] Leetcode challenge - Reverse String #leetcode #javascript #codinginterview
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var reverseString = function(s) { | |
let left = 0; let right = s.length - 1; | |
while (left < right) { | |
let tmp = s[left]; | |
s[left++] = s[right]; | |
s[right--] = tmp; | |
} | |
return s; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment