刷题的日常[Leetcode]——344)reverse string

来源:互联网 发布:2017年淘宝怎么做 编辑:程序博客网 时间:2024/06/12 05:07

题目描述:

把str反转

注意:

s[::-1]可以倒置字符串

class Solution(object):    def reverseString(self, s):        """        :type s: str        :rtype: str        """        return s[::-1]if __name__=="__main__":sol=Solution()s="hello"res=sol.reverseString(s)print res        

0 0
原创粉丝点击