Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 196. love is an n-letter word

Given 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 + 'o'-'v'=7 + 'v'-'e'=17 ; compare for example to the possible word 'aave' which has a total letter-distance of 38)

Tags

Problem Group

19 solvers submitted 125 solutions (6.58 solutions/solver).

Loading Solution Map...

Problem Comments

Solution Comments