Skip to main content
Reverse Words in a String | AlgoCracked
AlgoCracked
ProblemsReverse Words in a String
Medium42.0% acceptance
StringTwo Pointers

Reverse Words in a String

Given a string s of words separated by spaces, return a string of those words in reverse order , joined by a single space. Ignore leading and trailing spaces, and collapse any run of spaces between words to one. Input format Input is [s] , e.g. [ the sky is blue ] .

Loading workspace…