Technical Interview Question 4: Given a string with words and multiple white spaces around them, how would you trim it with only 1 white space between the words? / by Kaitlin Hung

Given a string with words and multiple white spaces around them, how would you trim it with only 1 white space between the words? For ex: input str = " Hello world " output = "Hello world".

Submit your answers in the comments and receive feedback.