DEV Community

Miss Pooja Anilkumar Patel
Miss Pooja Anilkumar Patel

Posted on

1

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)

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay