Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Solution {
- public String reverseString(char[] s) {
- int i = 0;
- int j = s.length - 1;
- while (i < j) {
- char temp = s[i];
- s[i] = s[j];
- s[j] = temp;
- i++;
- j--;
- }
- return null;
- }
- }
- public class Solution {
- public String reverseString(char[] s) {
- char[] t = new StringBuilder().append(s).reverse().toString().toCharArray();
- System.arraycopy(t, 0, s, 0, s.length);
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement