LeetCode: Reverse String

LeetCode: Reverse String

1
2
3
4
5
6
7
8
9
public class Solution {
public String reverseString(String s) {
if (s == null || s.length() < 2) {
return s;
}

return new StringBuilder(s).reverse().toString();
}
}