def reverseWords(self, s):
return ' '.join(reversed(s.split()))
This solution is awesome. Why no posts?
@tju_xu This solution takes O(N) time and O(N) space.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.