// Source : https://leetcode.com/problems/reverse-string
// Author : Dean Shi
// Date   : 2017-04-09

/***************************************************************************************
 *
 * Write a function that takes a string as input and returns the string reversed.
 *
 * Example:
 * Given s = "hello", return "olleh".
 *
 *
 ***************************************************************************************/

/**
 * @param {string} s
 * @return {string}
 */
var reverseString = function(s) {
    return s.split('').reverse().join('')
};

@@ -89,16 +89,16 @@
 : 20
-17
+20
 -04-0
-9
+4
 %0A%0A/*
@@ -184,19 +184,16 @@
 *******%0A
- *%0A
  * Write
@@ -213,11 +213,14 @@
 hat 
-tak
+revers
 es a
@@ -230,53 +230,292 @@
 ring
- as
+. The
  input 
-and returns the string rev
+string is given as an array of%0A * characters char%5B%5D.%0A * %0A * Do not allocate extra space for another array, you must do this by modifying the%0A * input array%C2%A0in-place with O(1) extra memory.%0A * %0A * You may assume all the characters consist of printable ascii charact
 ers
-ed
 .%0A *
+ 
 %0A * 
@@ -525,53 +525,183 @@
 mple
+ 1
 :%0A * 
-Given s = %22hello%22, return %22olleh%22.
+%0A * Input: %5B%22h%22,%22e%22,%22l%22,%22l%22,%22o%22%5D%0A * Output: %5B%22o%22,%22l%22,%22l%22,%22e%22,%22h%22%5D
 %0A *
+ 
 %0A *
+ Example 2:%0A * %0A * Input: %5B%22H%22,%22a%22,%22n%22,%22n%22,%22a%22,%22h%22%5D%0A * Output: %5B%22h%22,%22a%22,%22n%22,%22n%22,%22a%22,%22H%22%5D%0A * %0A * 
 %0A **
@@ -803,22 +803,27 @@
 @param %7B
-string
+character%5B%5D
 %7D s%0A * @
@@ -834,95 +834,239 @@
 rn %7B
-string%7D%0A */%0Avar reverseString = function(s) %7B%0A    return s.split('').reverse().join('')
+void%7D Do not return anything, modify s in-place instead.%0A */%0Avar reverseString = function(s) %7B%0A    const end = s.length / 2%0A    for (let i = 0; i %3C end; i++) %7B%0A        %5Bs%5Bi%5D, s%5Bs.length - i - 1%5D%5D = %5Bs%5Bs.length - i - 1%5D, s%5Bi%5D%5D%0A    %7D
 %0A%7D;%0A

Update ReverseString