Cody

Problem 77. Clean the List of Names

Solution 1218341

Submitted on 22 Jun 2017 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
names_in = {'bert','arthur','Bert','Fred'}; names_out = {'bert','arthur','Fred'}; assert(isequal(clean_list(names_in),names_out))

out = cell 'bert' out = 1×2 cell array 'bert' 'arthur' go = 0 out = 1×3 cell array 'bert' 'arthur' 'Fred'

2   Pass
names_in = {'bert','bill','billy','Bill'}; names_out = {'bert','bill','billy'}; assert(isequal(clean_list(names_in),names_out))

out = cell 'bert' out = 1×2 cell array 'bert' 'bill' out = 1×3 cell array 'bert' 'bill' 'billy' go = 0

3   Pass
names_in = {'George','Bernard','Shaw','shaw','Bernie','george'}; names_out = {'George','Bernard','Shaw','Bernie'}; assert(isequal(clean_list(names_in),names_out))

out = cell 'George' out = 1×2 cell array 'George' 'Bernard' out = 1×3 cell array 'George' 'Bernard' 'Shaw' go = 0 out = 1×4 cell array 'George' 'Bernard' 'Shaw' 'Bernie' go = 0

4   Pass
names_in = {'aaa','aAa','aAA','bbB','bbb','ccc'}; names_out = {'aaa','bbB','ccc'}; assert(isequal(clean_list(names_in),names_out))

out = cell 'aaa' go = 0 go = 0 out = 1×2 cell array 'aaa' 'bbB' go = 0 out = 1×3 cell array 'aaa' 'bbB' 'ccc'

5   Pass
names_in = {'one','two','three'}; names_out = {'one','two','three'}; assert(isequal(clean_list(names_in),names_out))

out = cell 'one' out = 1×2 cell array 'one' 'two' out = 1×3 cell array 'one' 'two' 'three'

Suggested Problems

More from this Author95

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!