diff --git a/151-reverse-words-in-a-string/151-reverse-words-in-a-string.py b/151-reverse-words-in-a-string/151-reverse-words-in-a-string.py new file mode 100644 index 0000000..9db908c --- /dev/null +++ b/151-reverse-words-in-a-string/151-reverse-words-in-a-string.py @@ -0,0 +1,5 @@ +class Solution: + def reverseWords(self, s: str) -> str: + words = s.split() + words.reverse() + return " ".join(words) \ No newline at end of file