美文网首页
27 - Easy - 反转字符串

27 - Easy - 反转字符串

作者: 1f872d1e3817 | 来源:发表于2018-05-18 13:23 被阅读0次

请编写一个函数,其功能是将输入的字符串反转过来。

示例:

输入:s = "hello"
返回:"olleh"

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

相关文章

网友评论

      本文标题:27 - Easy - 反转字符串

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