Finished a couple easy problems, then this medium problem. I feel like this was made easier by python’s list slicing.


Solution

class Solution:
    def reverseWords(self, s: str) -> str:
        return ' '.join(s.split()[::-1])

O(n) = n