Cody

Solution 1949999

Submitted on 26 Sep 2019 by Nikolaos Nikolaou
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
C = {'Ken'; 'GianCarlo'; 'Ken'; 'GianCarlo'; 'Bob'; 'Ken'; 'Sonia'}; repeatedStrings = {'Ken'; 'GianCarlo'}; assert(isequal(extractRepeatedStrings(C), repeatedStrings))

C = 1×7 cell array {'Ken'} {'GianCarlo'} {'Ken'} {'GianCarlo'} {'Bob'} {'Ken'} {'Sonia'} l = 0×1 empty cell array l = 1×5 cell array {'Ken'} {'GianCarlo'} {'Ken'} {'GianCarlo'} {'Ken'} r = 1×2 cell array {'Ken'} {'GianCarlo'} r = 2×1 cell array {'Ken' } {'GianCarlo'}

2   Pass
C = {'A', 'B', 'C', 'A', 'B'}; repeatedStrings = {'A'; 'B'}; assert(isequal(extractRepeatedStrings(C), repeatedStrings))

C = 1×5 cell array {'A'} {'B'} {'C'} {'A'} {'B'} l = 0×1 empty cell array l = 1×4 cell array {'A'} {'B'} {'A'} {'B'} r = 1×2 cell array {'A'} {'B'} r = 2×1 cell array {'A'} {'B'}

3   Pass
C = {'B', 'A', 'C', 'B', 'A'}; repeatedStrings = {'B'; 'A'}; assert(isequal(extractRepeatedStrings(C), repeatedStrings))

C = 1×5 cell array {'B'} {'A'} {'C'} {'B'} {'A'} l = 0×1 empty cell array l = 1×4 cell array {'B'} {'A'} {'B'} {'A'} r = 1×2 cell array {'B'} {'A'} r = 2×1 cell array {'B'} {'A'}

4   Pass
C = {'A', 'B', 'C'}; repeatedStrings = cell.empty(0, 1); assert(isequal(extractRepeatedStrings(C), repeatedStrings))

C = 1×3 cell array {'A'} {'B'} {'C'} l = 0×1 empty cell array l = 0×1 empty cell array r = 0×1 empty cell array r = 1×0 empty cell array r = 0×1 empty cell array

5   Pass
C = {'A', 'B'; 'C', 'A'; 'B', 'A'}; repeatedStrings = {'A'; 'B'}; assert(isequal(extractRepeatedStrings(C), repeatedStrings))

C = 1×6 cell array {'A'} {'C'} {'B'} {'B'} {'A'} {'A'} l = 0×1 empty cell array l = 1×5 cell array {'A'} {'B'} {'B'} {'A'} {'A'} r = 1×2 cell array {'A'} {'B'} r = 2×1 cell array {'A'} {'B'}