[leetcode, python] Reverse Words in a String 反转字符串
2016-12-30 00:16
555 查看
问题描述:
解决方案:
Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the".
解决方案:
class Solution(object): def reverseWords(self, s): """ :type s: str :rtype: str """ s_list = s.strip().split() re_s_list = s_list[::-1] return " ".join(re_s_list)
相关文章推荐
- [leetcode, python] Reverse Words in a String 反转字符串
- [leetcode, python] Reverse Words in a String 反转字符串
- [leetcode, python] Reverse Words in a String 反转字符串
- [leetcode, python] Reverse Words in a String 反转字符串
- [leetcode, python] Reverse Words in a String 反转字符串
- [leetcode, python] Reverse Words in a String 反转字符串
- [leetcode, python] Reverse Words in a String 反转字符串
- [leetcode, python] Reverse Words in a String 反转字符串
- [leetcode, python] Reverse Words in a String 反转字符串
- [leetcode, python] Reverse Words in a String 反转字符串
- [leetcode, python] Reverse Words in a String 反转字符串
- 字符串反转 reverse-words-in-a-string @LeetCode
- LeetCode Reverse Words in a String(反转字符串)
- LeetCode Reverse Words in a String(反转字符串)
- 【LeetCode-面试算法经典-Java实现】【151-Reverse Words in a String(反转字符串中的单词)】
- 【LeetCode】Reverse Words in a String 反转字符串中的单词
- leetcode Reverse Words in a String III 反转字符串中的单词
- LeetCode | Reverse Words in a String(字符串中的单词序反转)
- leetcode 【 Reverse Words in a String 】python 实现
- LeetCode:151_Reverse Words in a String | 字符串中单词的逆反 | Medium