每天一道LeetCode--344. Reverse String

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) {
        StringBuilder sb=new StringBuilder();
        sb.append(s);
        return sb.reverse().toString();
    }
}

 

posted @ 2016-11-24 09:54  破玉  阅读(233)  评论(0编辑  收藏  举报