Cody

# Problem 362. Find matching string from a list of strings

Solution 2159884

Submitted on 14 Mar 2020
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   Pass
inStr = 'ball'; strList = {'ball', 'bell', 'barn'}; assert(isequal(findMatch(inStr, strList), 'ball'));

2   Pass
inStr = 'auG'; strList = {'May', 'June', 'July', 'August', 'September'}; assert(isequal(findMatch(inStr, strList), 'August'));

matchStrInWord = 1×5 cell array {0×0 double} {0×0 double} {0×0 double} {[1]} {0×0 double} cand = 1

3   Fail
inStr = 'Ju'; strList = {'May', 'June', 'July', 'August', 'September'}; assert(isequal(findMatch(inStr, strList), ''));

matchStrInWord = 1×5 cell array {0×0 double} {[1]} {[1]} {0×0 double} {0×0 double} cand = 1 1

Assertion failed.

4   Pass
inStr = 'fontn'; strList = {'FontName', 'FontUnits', 'FontSize', 'FontWeight'}; assert(isequal(findMatch(inStr, strList), 'FontName'));

matchStrInWord = 1×4 cell array {[1]} {0×0 double} {0×0 double} {0×0 double} cand = 1

5   Pass
inStr = 'weight'; strList = {'FontName', 'FontUnits', 'FontSize', 'FontWeight'}; assert(isequal(findMatch(inStr, strList), 'FontWeight'));

matchStrInWord = 1×4 cell array {0×0 double} {0×0 double} {0×0 double} {[1]} cand = 1

6   Pass
inStr = 'ball'; strList = {'baseball', 'balloon', 'ball'}; assert(isequal(findMatch(inStr, strList), 'ball'));

7   Fail
inStr = 'bal'; strList = {'baseball', 'balloon', 'ball'}; assert(isequal(findMatch(inStr, strList), ''));

matchStrInWord = 1×3 cell array {[1]} {[1]} {[1]} cand = 1 1 1

Assertion failed.