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