您的位置:首页 > 编程语言 > Python开发

[Leetcode,python] Reverse String 反转字符串

2016-08-03 09:35 387 查看
问题描述:

Write a function that takes a string as input and returns the string reversed.

Example:

Given s = "hello", return "olleh".

解决方案:

class Solution(object):
def reverseString(self, s):
"""
:type s: str
:rtype: str
"""
return s[::-1]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  算法 leetcode