leetcode 344 Reverse String

Java:

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

Python:

class Solution:
    def reverseString(self, s):
        """
        :type s: str
        :rtype: str
        """
        return s[::-1]

猜你喜欢

转载自blog.csdn.net/mrxjh/article/details/79785870