DEV Community

Miss Pooja Anilkumar Patel
Miss Pooja Anilkumar Patel

Posted on

151. Leetcode Solution in Python3

class Solution: def reverseWords(self, s: str) -> str: return ' '.join(reversed(s.split())) 
Enter fullscreen mode Exit fullscreen mode

leetcode

challenge

Here is the link for the problem:
https://leetcode.com/problems/reverse-words-in-a-string/

Top comments (0)