山竹山竹px

关注

557. 反转字符串中的单词 III

山竹山竹px

关注

阅读 59

2022-05-23


557. 反转字符串中的单词 III_反转字符串

class Solution:
def reverseWords(self, s):
"""
:type s: str
:rtype: str
"""
words = s.split(' ')
for i in range(len(words)):
words[i] = words[i][:: -1]
return ' '.join(words)

1.主要思路识别空格,以空格分开单词,然后变换为344反转字符串



相关推荐

JamFF

【LeeCode】557. 反转字符串中的单词 III

JamFF 69 0 0

攻城狮Chova

Leetcode 557: 反转字符串中的单词 III

攻城狮Chova 292 0 0

爱情锦囊

leetcode -- 557反转字符串中的单词 III

爱情锦囊 185 0 0

朱悟能_9ad4

leetcode-557-反转字符串中的单词 III 题解

朱悟能_9ad4 62 0 0

狗啃月亮_Rachel

【LeetCode125、557】验证回文串、反转字符串中的单词III

狗啃月亮_Rachel 72 0 0

爱做梦的老巫婆

反转字符串中的单词 III(JS)

爱做梦的老巫婆 57 0 0

白衣蓝剑冰魄

刷题之反转字符串中的单词 III

白衣蓝剑冰魄 30 0 0

东言肆语

557. Reverse Words in a String III

东言肆语 55 0 0

凯约

557. Reverse Words in a String III*

凯约 47 0 0

NicoalsNC

PHP反转字符串中的每个单词

NicoalsNC 10 0 0

精彩评论(0)

0 0 举报