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)
Solution Stats
Problem Comments
-
5 Comments
does somebody understand why
diff( ‘test’ )
in my solution 19016 causes this error
Error: License checkout failed.
License Manager Error 0
For further information, refer to the FLEXnet Licensing documentation,
available at "www.flexerasoftware.com".
Troubleshoot this issue by visiting:
http://www.mathworks.com/support/lme/R2011b/0
Diagnostic Information:
Feature: MATLAB_Distrib_Comp_Engine
License path: 13501@10.206.97.41:13501@10.195.79.113:/tmp/matlabpref/.matlab/R2011b_licenses:/opt/mlsedu/matlab/R2011b/licenses/license.dat:/opt/mlsedu/matlab/R2011b/licenses
FLEXnet Licensing error: 0,0.
it doesn’t in my local Matlab ( 2011a )
apparently it tries to call an overloaded diff ( probably from the symbolic toolbox ) for which it doesn’t have a license
@Martijn: I am not sure why that is happening but in the meantime using "diff(double('test'))" should work fine
fixed look-up table hack
good
Solution Comments
Show commentsProblem Recent Solvers54
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15747 Solvers
-
Get the area codes from a list of phone numbers
1070 Solvers
-
Similar Triangles - find the height of the tree
456 Solvers
-
Matrix which contains the values of an other matrix A at the given locations.
238 Solvers
-
Are all the three given point in the same line?
596 Solvers
More from this Author36
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!