Cody

Problem 77. Clean the List of Names

Solution 1232330

Submitted on 16 Jul 2017 by Noriko Hounoki
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))

ind = 1 names_out = cell 'bert' fg = 1×4 logical array 1 0 1 0 names_in = 1×2 cell array 'arthur' 'Fred' ind = 2 names_out = 1×2 cell array 'bert' 'arthur' fg = 1×2 logical array 1 0 names_in = cell 'Fred' ind = 3 names_out = 1×3 cell array 'bert' 'arthur' 'Fred' fg = logical 1 names_in = 1×0 empty cell array ind = 4

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

ind = 1 names_out = cell 'bert' fg = 1×4 logical array 1 0 0 0 names_in = 1×3 cell array 'bill' 'billy' 'Bill' ind = 2 names_out = 1×2 cell array 'bert' 'bill' fg = 1×3 logical array 1 0 1 names_in = cell 'billy' ind = 3 names_out = 1×3 cell array 'bert' 'bill' 'billy' fg = logical 1 names_in = 1×0 empty cell array ind = 4

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

ind = 1 names_out = cell 'George' fg = 1×6 logical array 1 0 0 0 0 1 names_in = 1×4 cell array 'Bernard' 'Shaw' 'shaw' 'Bernie' ind = 2 names_out = 1×2 cell array 'George' 'Bernard' fg = 1×4 logical array 1 0 0 0 names_in = 1×3 cell array 'Shaw' 'shaw' 'Bernie' ind = 3 names_out = 1×3 cell array 'George' 'Bernard' 'Shaw' fg = 1×3 logical array 1 1 0 names_in = cell 'Bernie' ind = 4 names_out = 1×4 cell array 'George' 'Bernard' 'Shaw' 'Bernie' fg = logical 1 names_in = 1×0 empty cell array ind = 5

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

ind = 1 names_out = cell 'aaa' fg = 1×6 logical array 1 1 1 0 0 0 names_in = 1×3 cell array 'bbB' 'bbb' 'ccc' ind = 2 names_out = 1×2 cell array 'aaa' 'bbB' fg = 1×3 logical array 1 1 0 names_in = cell 'ccc' ind = 3 names_out = 1×3 cell array 'aaa' 'bbB' 'ccc' fg = logical 1 names_in = 1×0 empty cell array ind = 4

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

ind = 1 names_out = cell 'one' fg = 1×3 logical array 1 0 0 names_in = 1×2 cell array 'two' 'three' ind = 2 names_out = 1×2 cell array 'one' 'two' fg = 1×2 logical array 1 0 names_in = cell 'three' ind = 3 names_out = 1×3 cell array 'one' 'two' 'three' fg = logical 1 names_in = 1×0 empty cell array ind = 4