Cody

Solution 1905780

Submitted on 20 Aug 2019 by Thomas Werner
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))

a = 2 3 5 h = 2 3 5 u = 0×1 empty double column vector o = 0×1 empty double column vector a = 2 3 2 5 3 5 h = 2 5 2 7 3 8 u = 3 o = 2 ind = 2 ind = 2 3 ind = 2 3

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

a = 5 3 2 h = 5 3 2 u = 3 o = 1 ind = 3 ind = 3

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

a = 2 3 5 h = 2 3 5 u = 0×1 empty double column vector o = 0×1 empty double column vector a = 2 3 2 5 3 5 h = 2 5 2 7 3 8 u = 0×1 empty double column vector o = 0×1 empty double column vector a = 2 3 5 h = 2 5 10 u = 1×0 empty double row vector o = 1×0 empty double row vector

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

a = 1 1 1 1 1 h = 1 1 1 1 1 u = 0×1 empty double column vector o = 0×1 empty double column vector a = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 h = 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 u = 0×1 empty double column vector o = 0×1 empty double column vector a = 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 h = 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 u = 0×1 empty double column vector o = 0×1 empty double column vector a = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 h = 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 u = 0×1 empty double column vector o = 0×1 empty double column vector a = 1 1 1 1 1 h = 1 2 3 4 5 u = 1 o = 5 ind = 1 ind = 1 1 2 ind = 1 1 2 1 2 3 ind = 1 1 2 1 2 3 1 2 3 4 ind = 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 ind = 1 2 3 4 5

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

a = 1 2 3 4 100 h = 1 2 3 4 100 u = 5 o = 1 ind = 5 ind = 5

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

a = -7 -3 -2 8 5 h = -7 -3 -2 8 5 u = 0×1 empty double column vector o = 0×1 empty double column vector a = -7 -3 -7 -2 -7 8 -7 5 -3 -2 -3 8 -3 5 -2 8 -2 5 8 5 h = -7 -10 -7 -9 -7 1 -7 -2 -3 -5 -3 5 -3 2 -2 6 -2 3 8 13 u = 0×1 empty double column vector o = 0×1 empty double column vector a = -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 h = -7 -10 -12 -7 -10 -2 -7 -10 -5 -7 -9 -1 -7 -9 -4 -7 1 6 -3 -5 3 -3 -5 0 -3 5 10 -2 6 11 u = 8 o = 3 ind = 2 ind = 2 3 ind = 2 3 5 ind = 2 3 5

Suggested Problems

More from this Author95