Skip to content

Commit 6c14e42

Browse files
committed
String
1 parent 3a2ecbe commit 6c14e42

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

String/reverse_words.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Problem source: https://leetcode.com/problems/reverse-words-in-a-string/description/?envType=study-plan-v2&envId=top-interview-150
2+
3+
class Solution:
4+
def reverseWords(self, s: str) -> str:
5+
return " ".join(s.split()[::-1])

0 commit comments

Comments
 (0)