Cody

Solution 121894

Submitted on 1 Aug 2012 by Greg
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
%% strs = {'aa','bb','aa','aa'}; correct = {'aa'}; result = duplicates(strs); assert(isempty(setdiff(result,correct)) & isempty(setdiff(correct,result)))

num = 3 1 val = 'aa' 'bb' ans = 'aa'

2   Pass
%% strs = {'10','11','12'}; correct = {}; result = duplicates(strs); assert(isempty(setdiff(result,correct)) & isempty(setdiff(correct,result)))

num = 1 1 1 val = '10' '11' '12' ans = Empty cell array: 1-by-0

3   Pass
%% strs = {'zzz','zzz','zzz'}; correct = {'zzz'}; result = duplicates(strs); assert(isempty(setdiff(result,correct)) & isempty(setdiff(correct,result)))

num = 3 val = 'zzz' ans = 'zzz'

4   Pass
%% strs = {'a','b','c','b','d','c'}; correct = {'b','c'}; result = duplicates(strs); assert(isempty(setdiff(result,correct)) & isempty(setdiff(correct,result)))

num = 1 2 2 1 val = 'a' 'b' 'c' 'd' ans = 'b' 'c'

5   Pass
%% strs = {}; correct = {}; result = duplicates(strs); assert(isempty(setdiff(result,correct)) & isempty(setdiff(correct,result)))

num = [] val = Empty cell array: 0-by-1 ans = {}

Suggested Problems

More from this Author95