Cody

Solution 2105008

Submitted on 24 Jan 2020
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
v = [2, 3, 5]; n = 8; correct = [2, 3]; actual = subset_sum(v, n); assert(isequal(actual, correct))

combi = 2 3 5 result = 0 2 result = 0 2 3 result = 0 2 3 5 combi = 2 3 2 5 3 5 result = 0 2 3 5 5 result = 0 2 3 5 5 7 result = 0 2 3 5 5 7 8 combrec = 3 5 combi = 2 3 5 result = 0 2 3 5 5 7 8 10

Assertion failed.

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

combi = 5 3 2 result = 0 5 result = 0 5 3 result = 0 5 3 2 combrec = 2 combi = 5 3 5 2 3 2 result = 0 5 3 2 8 result = 0 5 3 2 8 7 result = 0 5 3 2 8 7 5 combi = 5 3 2 result = 0 5 3 2 8 7 5 10

Assertion failed.

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

combi = 2 3 5 result = 0 2 result = 0 2 3 result = 0 2 3 5 combi = 2 3 2 5 3 5 result = 0 2 3 5 5 result = 0 2 3 5 5 7 result = 0 2 3 5 5 7 8 combi = 2 3 5 result = 0 2 3 5 5 7 8 10

Unrecognized function or variable 'combrec'. Error in subset_sum (line 17) ind = combrec; Error in Test3 (line 4) actual = subset_sum(v, n);

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

combi = 1 1 1 1 1 result = 0 1 result = 0 1 1 result = 0 1 1 1 result = 0 1 1 1 1 result = 0 1 1 1 1 1 combi = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 result = 0 1 1 1 1 1 2 result = 0 1 1 1 1 1 2 2 result = 0 1 1 1 1 1 2 2 2 result = 0 1 1 1 1 1 2 2 2 2 result = 0 1 1 1 1 1 2 2 2 2 2 result = 0 1 1 1 1 1 2 2 2 2 2 2 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 combi = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 combi = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 result = 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 result = Columns 1 through 30 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 Column 31 4 combi = 1 1 1 1 1 result = Columns 1 through 30 0 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 Columns 31 through 32 4 5 combrec = 1 1 1 1 1

Assertion failed.

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

combi = 1 2 3 4 100 result = 0 1 result = 0 1 2 result = 0 1 2 3 result = 0 1 2 3 4 result = 0 1 2 3 4 100 combrec = 100 combi = 1 2 1 3 1 4 1 100 2 3 2 4 2 100 3 4 3 100 4 100 result = 0 1 2 3 4 100 3 result = 0 1 2 3 4 100 3 4 result = 0 1 2 3 4 100 3 4 5 result = 0 1 2 3 4 100 3 4 5 101 result = 0 1 2 3 4 100 3 4 5 101 5 result = 0 1 2 3 4 100 3 4 5 101 5 6 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 combi = 1 2 3 1 2 4 1 2 100 1 3 4 1 3 100 1 4 100 2 3 4 2 3 100 2 4 100 3 4 100 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 103 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 103 8 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 103 8 104 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 103 8 104 105 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 103 8 104 105 9 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 103 8 104 105 9 105 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 103 8 104 105 9 105 106 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 103 8 104 105 9 105 106 107 combi = 1 2 3 4 1 2 3 100 1 2 4 100 1 3 4 100 2 3 4 100 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 103 8 104 105 9 105 106 107 10 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 103 8 104 105 9 105 106 107 10 106 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 103 8 104 105 9 105 106 107 10 106 107 result = 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 103 8 104 105 9 105 106 107 10 106 107 108 result = Columns 1 through 30 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 103 8 104 105 9 105 106 107 10 106 107 108 Column 31 109 combi = 1 2 3 4 100 result = Columns 1 through 30 0 1 2 3 4 100 3 4 5 101 5 6 102 7 103 104 6 7 103 8 104 105 9 105 106 107 10 106 107 108 Columns 31 through 32 109 110

Assertion failed.

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

combi = -7 -3 -2 8 5 result = 0 -7 result = 0 -7 -3 result = 0 -7 -3 -2 result = 0 -7 -3 -2 8 result = 0 -7 -3 -2 8 5 combi = -7 -3 -7 -2 -7 8 -7 5 -3 -2 -3 8 -3 5 -2 8 -2 5 8 5 result = 0 -7 -3 -2 8 5 -10 result = 0 -7 -3 -2 8 5 -10 -9 result = 0 -7 -3 -2 8 5 -10 -9 1 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 combi = -7 -3 -2 -7 -3 8 -7 -3 5 -7 -2 8 -7 -2 5 -7 8 5 -3 -2 8 -3 -2 5 -3 8 5 -2 8 5 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 -5 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 -5 -1 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 -5 -1 -4 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 -5 -1 -4 6 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 -5 -1 -4 6 3 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 -5 -1 -4 6 3 0 combrec = -2 8 5 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 -5 -1 -4 6 3 0 10 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 -5 -1 -4 6 3 0 10 11 combi = -7 -3 -2 8 -7 -3 -2 5 -7 -3 8 5 -7 -2 8 5 -3 -2 8 5 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 -5 -1 -4 6 3 0 10 11 -4 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 -5 -1 -4 6 3 0 10 11 -4 -7 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 -5 -1 -4 6 3 0 10 11 -4 -7 3 result = 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 -5 -1 -4 6 3 0 10 11 -4 -7 3 4 result = Columns 1 through 30 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 -5 -1 -4 6 3 0 10 11 -4 -7 3 4 Column 31 8 combi = -7 -3 -2 8 5 result = Columns 1 through 30 0 -7 -3 -2 8 5 -10 -9 1 -2 -5 5 2 6 3 13 -12 -2 -5 -1 -4 6 3 0 10 11 -4 -7 3 4 Columns 31 through 32 8 1

Assertion failed.

Suggested Problems

More from this Author95