[leetcode, python] Reverse Words in a String 反转字符串
来源:互联网 发布:java 队列 编辑:程序博客网 时间:2024/05/17 04:01
问题描述:
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)
0 0
- [leetcode, python] Reverse Words in a String 反转字符串
- LeetCode Reverse Words in a String(反转字符串)
- LeetCode Reverse Words in a String(反转字符串)
- 字符串反转 reverse-words-in-a-string @LeetCode
- Leetcode - Python - Reverse Words in a String
- [LeetCode]Reverse Words in a String-反转单词
- [Leetcode] reverse words in a string 反转单词
- LeetCode 151. Reverse Words in a String(反转单词)
- Reverse Words in a String 字符串中单词反转
- LeetCode | Reverse Words in a String(字符串中的单词序反转)
- [LeetCode]557. Reverse Words in a String III(反转字符串 III)
- LeetCode 557 Reverse Words in a String III(反转字符串中的单词3)
- leetcode Reverse Words in a String III 反转字符串中的单词
- Leetcode【字符串】: Reverse Words in a String 要点分析
- leetcode 151. Reverse Words in a String 字符串 翻转
- LeetCode 151 Reverse Words in a String (字符串处理 推荐)
- 字符串-leetcode 557 Reverse Words in a String III
- leetcode 151. Reverse Words in a String 字符串分割逆序
- Mom,Tue,Wed,Thu,Fri,Sat,Sun判断周几
- android spinner的问题
- 如何利用html5开发android界面??
- 侧滑栏按钮点击显示unfortunately has stop
- 关于4.4以下 webview的替换方案
- [leetcode, python] Reverse Words in a String 反转字符串
- 简单点亮发光二极管实例(位操作)
- 开源基于Face++的Android应用刷脸神器(HowOld)
- 无法连接局域网中的sqlserver数据库
- 在Fragment加了个webview 怎么监听返回事件
- 写在年末——聚合类应用趋势
- 我想点击fragment 的listview然后就进入子listview,再点击子listview就进入下一个子listview
- 关于跳转传递对象
- 关于第三方登录后,如何将登录的fragment立马替换成个人的fragment,FragmentManager