Cody

# Problem 43. Subset Sum

Solution 2023210

Submitted on 15 Nov 2019 at 14:41 by Daniel Fry
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
v = [2, 3, 5]; n = 8; correct = [2, 3]; actual = subset_sum(v, n); assert(isequal(actual, correct))

check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10

2   Pass
v = [5, 3, 2]; n = 2; correct = 3; actual = subset_sum(v, n); assert(isequal(actual, correct))

check = 2 check = 3 check = 5 check = 5 check = 7 check = 8 check = 10

3   Pass
v = [2, 3, 5]; n = 4; correct = []; actual = subset_sum(v, n); assert(isequal(actual, correct))

check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = 8 check = 2 check = 7 check = 5 check = 10 check = 5 check = 3 check = ...

4   Pass
v = [1, 1, 1, 1, 1]; n = 5; correct = [1, 2, 3, 4, 5]; actual = subset_sum(v, n); assert(isequal(actual, correct))

check = 1 check = 1 check = 2 check = 1 check = 2 check = 2 check = 3 check = 1 check = 2 check = 2 check = 3 check = 2 check = 3 check = 3 check = 4 check = 1 check = 2 check = 2 check = 3 check = 2 check = 3 check = 3 check = 4 check = 2 check = 3 check = 3 check = 4 check = 3 check = 4 check = 4 check = 5

5   Pass
v = [1, 2, 3, 4, 100]; n = 100; correct = 5; actual = subset_sum(v, n); assert(isequal(actual, correct))

check = 100 check = 4 check = 104 check = 3 check = 103 check = 7 check = 107 check = 2 check = 102 check = 6 check = 106 check = 5 check = 105 check = 9 check = 109 check = 1 check = 101 check = 5 check = 105 check = 4 check = 104 check = 8 check = 108 check = 3 check = 103 check = 7 check = 107 check = 6 check = 106 check = 10 check = 110

6   Pass
v = [-7, -3, -2, 8, 5]; n = 0; correct = [2, 3, 5]; actual = subset_sum(v, n); assert(isequal(actual, correct))

check = 5 check = 8 check = 13 check = -2 check = 3 check = 6 check = 11 check = -3 check = 2 check = 5 check = 10 check = -5 check = 0 check = 3 check = 8 check = -7 check = -2 check = 1 check = 6 check = -9 check = -4 check = -1 check = 4 check = -10 check = -5 check = -2 check = 3 check = -12 check = -7 check = -4 check = 1