Reverse String
Write a function that takes a string as input and returns the string reversed.
Example: Given s = "hello", return "olleh".
public class Solution {
public String reverseString(String s) {
int left = 0, right = s.length()-1;
char temp;
char[] list = s.toCharArray();
while(left<right){
temp = list[left];
list[left] = list[right];
list[right] = temp;
left++; right--;
}
return new String(list);
}
}