We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3a2ecbe commit 6c14e42Copy full SHA for 6c14e42
String/reverse_words.py
@@ -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