Reverse Words in a String
Medium
Strings
Given a string s, reverse the order of its words. Words are separated by one or more spaces. The output must contain the words separated by a single space with no leading or trailing spaces.
Constraints
1 <= len(s) <= 10^4 s has at least one word
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.