Given list of phrases, connect all the phrases using common first and last words.
For example,
phrases = {"I like bubblegum",
"bubblegum that is pink",
"hi, how are you today",
"today on this fine day",
"day that is sunny"
}
The answer will be:
{"I like bubblegum that is pink", "hi, how are you today on this fine day that is sunny"}
The order of the output phrases doesn't matter (I think they just want you to connect as many as possible).
Challenge: do this in O(n). They didn't really define n, I guess they just want you to loop through the phrases a constant number of times?