标签:
Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh".
public class Solution { public String reverseString(String s) { char[] c=new char[s.length()]; int j=0; for(int i=s.length()-1; i>=0; i--){ c[j]=s.charAt(i); j++; } return new String(c); } }
标签:
原文地址:http://www.cnblogs.com/incrediblechangshuo/p/5683307.html