美文网首页
344. Reverse String - LeetCode

344. Reverse String - LeetCode

作者: deactivateuser | 来源:发表于2016-08-17 17:59 被阅读19次

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

相关文章

网友评论

      本文标题:344. Reverse String - LeetCode

      本文链接:https://www.haomeiwen.com/subject/hegmsttx.html