Skip to content

Instantly share code, notes, and snippets.

Created September 17, 2017 16:53
public class Solution {
public String reverseString(String s) {
if (s == null) {
return null;
}
int len = s.length();
char[] cs = new char[len];
for (int i = 0; i < len; i++) {
cs[len - 1 - i] = s.charAt(i);
}
return new String(cs);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment