Write a function that takes a string as input and returns the string reversed.
Example:
Given s = "hello", return "olleh".
代码如下:
方法一:
1 public class Solution {2 public String reverseString(String s) {3 4 StringBuffer t=new StringBuffer(s);5 return t.reverse().toString();6 }7 }
原标题:344. Reverse String
关键词:string