Cody

# Problem 840. SET (the card game)

Solution 1626388

Submitted on 13 Sep 2018 by Jens Kjærgaard Boldsen
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

sets = 2 7 8 6 8 11

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

sets = 4 5 6 4 8 11 2 9 10

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

sets = 3 4 5 1 5 12 1 6 7 6 10 11

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

sets = 0×3 empty double matrix

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

sets = 4 5 11 2 6 11 5 6 12 1 7 11 2 9 10

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

sets = 1 2 3 2 4 9 4 5 12 3 7 10 1 8 10

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

sets = 1 8 11