151. Reverse Words in a String
mediumTwo Pointers · String
read the problem on leetcode →
first solved 12 Sept 2026
class Solution:
def reverseWords(self, s: str) -> str:
slist=s.split()
return " ".join(slist[::-1])
Two Pointers · String
read the problem on leetcode →
first solved 12 Sept 2026
class Solution:
def reverseWords(self, s: str) -> str:
slist=s.split()
return " ".join(slist[::-1])