LeetCode OJ 系列之151 Reverse Words in a String --Python
来源:互联网 发布:左耳最后说了什么 知乎 编辑:程序博客网 时间:2024/06/06 07:31
Problem:
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue
",
return "blue is sky the
".
Update (2015-02-12):
For C programmers: Try to solve it in-place in O(1) space.
class Solution(object): def reverseWords(self, s): """ :type s: str :rtype: str """ tmp = s.split() if len(tmp) == 0: return "" results = tmp[-1] for i in range(len(tmp)-2,-1,-1): results += " "+tmp[i] return results
0 0
- LeetCode OJ 系列之151 Reverse Words in a String --Python
- LeetCode OJ:Reverse Words in a String
- LeetCode OJ :Reverse Words in a String
- Reverse Words in a String -LeetCode OJ
- Leetcode OJ : Reverse Words in a String
- [LeetCode OJ] Reverse Words in a String
- LeetCode OJ:Reverse Words in a String
- LeetCode OJ : Reverse Words in a String
- LeetCode OJ Reverse Words in a String
- python:leetcode之reverse words in a string
- Leetcode - Python - Reverse Words in a String
- leetcode之Reverse Words in a string
- leetcode之Reverse Words in a String
- leetcode之Reverse Words in a String
- LeetCode之Reverse Words in a String
- Leetcode之Reverse Words in a String
- leetcode之Reverse Words in a String
- Leetcode之Reverse Words in a String
- LeetCode OJ 系列之65 Valid Number --Python
- LeetCode OJ 系列之58 Length of Last Word --Python
- LeetCode OJ 系列之75 Sort Colors --Python
- Medium题目总结
- LeetCode OJ 系列之165 Compare Version Numbers --Python
- LeetCode OJ 系列之151 Reverse Words in a String --Python
- eu in haskell
- Linux 学习路线图
- 回调函数透彻理解Java
- 【深夜】:为什么你是一个loser?
- Eclipse&JavaEE之中的引入项目运行错误问题
- eclipse android 电量显示
- POJ 3752 解题报告
- 指示当前焦点