Cody

# Problem 840. SET (the card game)

Solution 1634562

Submitted on 27 Sep 2018 by goc3
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
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

2   Pass
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

3   Pass
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

4   Pass
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

5   Pass
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

6   Pass
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

7   Pass
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