Approach hintTry it first, then revealHide
Extract the words while skipping runs of spaces, then join them in reverse order with single spaces. For O(1) extra space, reverse the whole string and then reverse each word.
Extract the words while skipping runs of spaces, then join them in reverse order with single spaces. For O(1) extra space, reverse the whole string and then reverse each word.