MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayGiven a list of **N words**, return the **N-letter word** (choosing one letter from each word) with the property of having the least distance between each pair of two consecutive letters (if there are multiple optimal solutions return any one of them).

Example: s1 = {'abcd','bcde','cdef','defg'}; should return s2 = 'dddd'; (with total letter-distance = 0)

Example: s1={'aldfejk','czoa','vwy','abcde'}; should return s2='love'; (with total letter-distance = 27: * 'l'-'o'*=3 +

42 correct solutions
90 incorrect solutions

Last solution submitted on Dec 12, 2014

2 players like this problem

1 Comment

Alfonso Nieto-Castanon
on 8 Mar 2012

sorry about the needed hack to match the test suite solutions, I have clarified the text and corrected the test suite so that now in cases of multiple optima your function may return any one of them.

2 Comments

Alfonso Nieto-Castanon
on 16 Feb 2012

nice exhaustive search

J.R.! Menzinger
on 18 Feb 2014

After some attempts, I reached also a kind of solution like this...

4 Comments