Cody

Solution 517034

Submitted on 27 Oct 2014 by MDK
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)))

dups = {} i=1, j=2, comp=0 i=1, j=3, comp=1 dups = 'aa' i=1, j=4, comp=1 i=2, j=3, comp=0 i=2, j=4, comp=0 i=3, j=4, comp=1 dups = 'aa'

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

dups = {} i=1, j=2, comp=0 i=1, j=3, comp=0 i=2, j=3, comp=0 dups = {}

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

dups = {} i=1, j=2, comp=1 dups = 'zzz' i=1, j=3, comp=1 i=2, j=3, comp=1 dups = '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)))

dups = {} i=1, j=2, comp=0 i=1, j=3, comp=0 i=1, j=4, comp=0 i=1, j=5, comp=0 i=1, j=6, comp=0 i=2, j=3, comp=0 i=2, j=4, comp=1 dups = 'b' i=2, j=5, comp=0 i=2, j=6, comp=0 i=3, j=4, comp=0 i=3, j=5, comp=0 i=3, j=6, comp=1 dups = 'b' 'c' i=4, j=5, comp=0 i=4, j=6, comp=0 i=5, j=6, comp=0 dups = 'b' 'c'

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

dups = {} dups = {}