首页 > 代码库 > LeetCode之344. Reverse String

LeetCode之344. Reverse String

技术分享

-------------------------------

 

Java也可以实现一行代码反转字符串哦 技术分享

 

AC代码如下:

public class Solution {
    public String reverseString(String s) {
        return new StringBuffer(s).reverse().toString();
    }
}

 

题目来源: https://leetcode.com/problems/reverse-string/

LeetCode之344. Reverse String