Cody

Solution 1967314

Submitted on 8 Oct 2019 by Augusto Mazzei
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
first = 'minimum'; second = 'maximum'; match = substrmatch( first, second ); assert( strcmp( match, 'imum' ) )

best = 'im' best = 'imu' best = 'imum'

2   Pass
first = 'aabbcc'; second = 'abc'; match = substrmatch( first, second ); assert( strcmp( match, 'ab' ) || strcmp( match, 'bc' ) )

best = 'ab'

3   Pass
first = 'MATLAB'; second = 'LAPACK'; match = substrmatch( first, second ); assert( strcmp( match, 'LA' ) )

best = 'LA'

4   Pass
first = 'abc'; second = 'def'; match = substrmatch( first, second ); assert( strcmp( match, '' ) )

5   Pass
first = 'banana'; second = 'anagram'; match = substrmatch( first, second ); assert( strcmp( match, 'ana' ) )

best = 'an' best = 'ana'

6   Pass
first = 'string within a string'; second = 'within'; match = substrmatch( first, second ); assert( strcmp( match, 'within' ) )

best = 'in' best = 'wit' best = 'with' best = 'withi' best = 'within'

7   Pass
first = 'yes and no'; second = 'ankles and noses'; match = substrmatch( first, second ); assert( strcmp( match, 'es and no' ) )

best = 'es' best = 'es ' best = 'es a' best = 'es an' best = 'es and' best = 'es and ' best = 'es and n' best = 'es and no'

8   Pass
first = 'three apples'; second = 'one apple'; match = substrmatch( first, second ); assert( strcmp( match, 'e apple' ) )

best = 'e ' best = 'e a' best = 'e ap' best = 'e app' best = 'e appl' best = 'e apple'

9   Pass
first = 'hello there'; second = 'jello that'; match = substrmatch( first, second ); assert( strcmp( match, 'ello th' ) )

best = 'el' best = 'ell' best = 'ello' best = 'ello ' best = 'ello t' best = 'ello th'

Suggested Problems

More from this Author5