1
2
3
4
5
6
7
|
class Solution:
def reverseWords(self, s: str) -> str:
s=list(s.split())
ans=''
for i in s:
ans+=i[::-1]+' '
return ans[:-1]
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence (0) | 2022.03.17 |
---|---|
leetcode 2185. Counting Words With a Given Prefix (0) | 2022.03.17 |
leetcode 2000. Reverse Prefix of Word (0) | 2022.03.16 |
leetcode 1704. Determine if String Halves Are Alike (0) | 2022.03.16 |
leetcode 1464. Maximum Product of Two Elements in an Array (0) | 2022.03.16 |
댓글