Cody

# Problem 840. SET (the card game)

Solution 1677237

Submitted on 20 Nov 2018
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   Fail
cards = [1 0 1 0 1 1 1 1 2 2 1 0 0 1 2 2 2 1 1 1 1 0 1 2 0 0 0 0 2 2 2 2 0 2 0 0 1 1 1 0 0 1 0 2 0 2 0 2]; sets_correct = [2 7 8 6 8 11]; sets = findSETs(cards); assert(isequal(size(sets),size(sets_correct))) for i=1:size(sets_correct) assert(ismember(sets_correct(i,:),sets,'rows')) end

Not enough input arguments. Error in ismember (line 73) if (isstring(A) || isstring(B)) Error in findSETs (line 10) ismember Error in Test1 (line 15) sets = findSETs(cards);

2   Fail
cards = [1 2 2 1 1 2 1 2 2 0 2 2 1 2 2 2 1 1 1 2 1 0 0 2 1 1 2 1 2 1 0 0 0 2 2 1 2 2 0 0 0 0 1 1 0 1 1 0]; sets_correct = [2 9 10 4 5 6 4 8 11]; sets = findSETs(cards); assert(isequal(size(sets),size(sets_correct))) for i=1:size(sets_correct) assert(ismember(sets_correct(i,:),sets,'rows')) end

Not enough input arguments. Error in ismember (line 73) if (isstring(A) || isstring(B)) Error in findSETs (line 10) ismember Error in Test2 (line 16) sets = findSETs(cards);

3   Fail
cards = [2 2 2 0 2 2 1 1 1 0 1 1 2 2 0 1 0 1 2 1 1 1 0 1 0 0 1 2 1 2 0 0 1 0 1 0 1 2 1 1 1 0 2 1 1 0 2 2]; sets_correct = [1 5 12 1 6 7 3 4 5 6 10 11]; sets = findSETs(cards); assert(isequal(size(sets),size(sets_correct))) for i=1:size(sets_correct) assert(ismember(sets_correct(i,:),sets,'rows')) end

Not enough input arguments. Error in ismember (line 73) if (isstring(A) || isstring(B)) Error in findSETs (line 10) ismember Error in Test3 (line 17) sets = findSETs(cards);

4   Fail
cards = [0 1 2 0 0 1 2 1 1 2 0 1 1 2 0 2 0 0 0 0 1 1 1 1 1 1 1 2 1 1 0 2 2 2 1 1 2 2 2 0 2 0 0 0 1 1 0 0]; sets_correct = []; sets = findSETs(cards); assert(isequal(size(sets),size(sets_correct))) for i=1:size(sets_correct) assert(ismember(sets_correct(i,:),sets,'rows')) end

Not enough input arguments. Error in ismember (line 73) if (isstring(A) || isstring(B)) Error in findSETs (line 10) ismember Error in Test4 (line 14) sets = findSETs(cards);

5   Fail
cards = [0 1 2 0 0 1 2 1 1 2 0 1 1 2 0 2 0 0 0 0 1 1 1 1 1 1 1 2 1 1 0 2 2 2 1 1 1 0 0 1 2 1 0 1 2 2 2 2]; sets_correct = [1 7 11 2 6 11 2 9 10 4 5 11 5 6 12]; sets = findSETs(cards); assert(isequal(size(sets),size(sets_correct))) for i=1:size(sets_correct) assert(ismember(sets_correct(i,:),sets,'rows')) end

Not enough input arguments. Error in ismember (line 73) if (isstring(A) || isstring(B)) Error in findSETs (line 10) ismember Error in Test5 (line 18) sets = findSETs(cards);

6   Fail
cards = [1 2 2 0 0 2 0 1 2 2 1 2 2 0 1 0 2 1 0 2 2 0 1 2 2 1 2 2 0 1 1 1 1 1 2 2 2 0 0 2 0 2 1 1 2 2 2 1]; sets_correct = [1 2 3 1 8 10 2 4 9 3 7 10 4 5 12]; sets = findSETs(cards); assert(isequal(size(sets),size(sets_correct))) for i=1:size(sets_correct) assert(ismember(sets_correct(i,:),sets,'rows')) end

Not enough input arguments. Error in ismember (line 73) if (isstring(A) || isstring(B)) Error in findSETs (line 10) ismember Error in Test6 (line 18) sets = findSETs(cards);

7   Fail
cards = [1 0 1 0 1 1 1 1 2 2 1 0 0 1 2 2 2 1 1 1 1 0 1 2 0 0 0 0 2 2 2 1 0 2 0 0 1 1 1 0 0 1 0 2 0 2 0 2]; sets_correct = [1 8 11]; sets = findSETs(cards); assert(isequal(size(sets),size(sets_correct))) for i=1:size(sets_correct) assert(ismember(sets_correct(i,:),sets,'rows')) end

Not enough input arguments. Error in ismember (line 73) if (isstring(A) || isstring(B)) Error in findSETs (line 10) ismember Error in Test7 (line 14) sets = findSETs(cards);