0
kicks
Shortest String That Contains All Words
Mango12 created an interesting competition to kick off the New Year, and I decided to try it out. It’s a simple task along the lines of a code kata, and I recommend you try it yourself before looking over my solution. Task: Compress a list of words into the shortest string that contains all words. Test: “testing”, “ginger”, “german”, “minutes” should become “minutestingingerman” Here is my approach: create a weighted graph connecting each term then recursively reduce the highest weighted edges.