请编写一个函数,其功能是将输入的字符串反转过来。
示例:
输入:s = "hello"
返回:"olleh"思路
Python里面的切片用来解决这个问题就很快了,仅仅一行就实现了反转字符串!
赞美Python!
class Solution:
    def reverseString(self, s):
        """
        :type s: str
        :rtype: str
        """
        return s[::-1]原文:https://www.cnblogs.com/MartinLwx/p/9201138.html