Cody

Solution 2031690

Submitted on 22 Nov 2019
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)))

temp1 = 'aa' temp2 = 'bb' temp2 = 'aa' temp1 = 'bb' temp2 = 'aa' temp2 = 'aa' temp1 = 'aa' temp2 = 'aa'

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

temp1 = '10' temp2 = '11' temp2 = '12' temp1 = '11' temp2 = '12'

Output argument "dups" (and maybe others) not assigned during call to "duplicates". Error in Test2 (line 3) result = duplicates(strs);

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

temp1 = 'zzz' temp2 = 'zzz' temp1 = 'zzz' temp2 = '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)))

temp1 = 'a' temp2 = 'b' temp2 = 'c' temp2 = 'b' temp2 = 'd' temp2 = 'c' temp1 = 'b' temp2 = 'c' temp2 = 'b' temp1 = 'c' temp2 = 'b' temp2 = 'd' temp2 = 'c' temp1 = 'b' temp2 = 'd' temp2 = 'c' temp1 = 'd' temp2 = 'c'

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

Output argument "dups" (and maybe others) not assigned during call to "duplicates". Error in Test5 (line 3) result = duplicates(strs);