Cody

Solution 1831282

Submitted on 30 May 2019
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
assert(isequal(Damerau_Levenshtein('mom','dad'),3)); % 3 substitutions

Error in solution Line: 1 Column: 41 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

2   Fail
assert(isequal(Damerau_Levenshtein('dogs','dog'),1)); % 1 deletion

Error in solution Line: 1 Column: 41 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

3   Fail
assert(isequal(Damerau_Levenshtein('true','true'),0)); % identity

Error in solution Line: 1 Column: 41 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

4   Fail
assert(isequal(Damerau_Levenshtein('true','false'),4)); % 1 insertion, 3 substitutions

Error in solution Line: 1 Column: 41 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

5   Fail
assert(isequal(Damerau_Levenshtein('abc','ca'),2)); % 1 deletion, 1 transposition

Error in solution Line: 1 Column: 41 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

6   Fail
assert(isequal(Damerau_Levenshtein('tee','tree'),1));

Error in solution Line: 1 Column: 41 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

7   Fail
assert(isequal(Damerau_Levenshtein('email','mails'),2));

Error in solution Line: 1 Column: 41 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

8   Fail
assert(isequal(Damerau_Levenshtein('profit','gifts'),5));

Error in solution Line: 1 Column: 41 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

9   Fail
% symmetry rnd=@()char(randi([97 122],1,randi([4 10]))); for k=1:10 str1=rnd(); str2=rnd(); a=Damerau_Levenshtein(str1,str2); b=Damerau_Levenshtein(str2,str1); assert(isequal(a,b)) end

Error in solution Line: 1 Column: 41 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

10   Fail
% trinagle inequality rnd=@()char(randi([97 122],1,randi([4 10]))); for k=1:50 str1=rnd(); str2=rnd(); str3=rnd(); a=Damerau_Levenshtein(str2,str3); b=Damerau_Levenshtein(str3,str1); c=Damerau_Levenshtein(str1,str2); assert(a+b>=c) end

Error in solution Line: 1 Column: 41 Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

More from this Author47