1592. Rearrange Spaces Between Words

needs to be careful about the only one word case, words.size()-1 would cause divide by zero

time: O(n)

space: O(n), result of text

Last updated

Was this helpful?