Created
September 17, 2017 16:53
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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