MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

### Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

# Solution 126182

Submitted on 10 Aug 2012

Incorrect

34Size
Leading solution size is 34.
`This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.`

### Test Suite

Test
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
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
```
```Error: Assertion failed.
```
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
```