Cody

# Problem 44940. Get Next Combination

Solution 2148408

Submitted on 2 Mar 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
assert(isequal(nextComb([1 2 3],5),[1 2 4]))

Assertion failed.

2   Fail
assert(isequal(nextComb([2 4 5],5),[3 4 5]))

Assertion failed.

3   Pass
assert(isequal(nextComb([3 4 5],5),[3 4 5])) % if it is the last combination in the list; return itself

4   Fail
assert(isequal(nextComb([1 3 4 5],5),[2 3 4 5]))

Assertion failed.

5   Fail
assert(isequal(nextComb([5 6 7 10],10),[5 6 8 9]))

Assertion failed.

6   Fail
assert(isequal(nextComb([2 3 4 5 10],10),[2 3 4 6 7]))

Assertion failed.

7   Fail
assert(isequal(nextComb([5 7 8 9 10],10),[6 7 8 9 10]))

Assertion failed.

8   Fail
assert(isequal(nextComb([8 10 17 19 20],20),[8 10 18 19 20]))

Assertion failed.

9   Fail
assert(isequal(nextComb([11 13 17 18 20],20),[11 13 17 19 20]))

Assertion failed.

10   Fail
assert(isequal(nextComb([7 8 13 17 19 20],20),[7 8 13 18 19 20]))

Assertion failed.

11   Fail
assert(isequal(nextComb([10 11 17 18 19 20],20),[10 12 13 14 15 16]))

Assertion failed.

12   Fail
assert(isequal(nextComb([12 16 17 18 19 20],20),[13 14 15 16 17 18]))

Assertion failed.

13   Fail
assert(isequal(nextComb([1:6 9 14 19 20 21 23 26 29 30],30),[1:6 9 14 19 20 21 23 27 28 29]))

Assertion failed.

14   Fail
assert(isequal(nextComb([1:5 7 11 13 15 18 19 21 22 27 29],30),[1:5 7 11 13 15 18 19 21 22 27 30]))

Assertion failed.

15   Fail
assert(isequal(nextComb([1:4 6 10 13 14 15 18 19 20 23 24 30],30),[1:4 6 10 13 14 15 18 19 20 23 25 26]))

Assertion failed.

16   Fail
assert(isequal(nextComb([1:17 19 23 27 33 40 42 48 50],50),[1:17 19 23 27 33 40 42 49 50]))

Assertion failed.

17   Fail
assert(isequal(nextComb([1:17 22 24 27 30 35 36 38 44],50),[1:17 22 24 27 30 35 36 38 45]))

Assertion failed.

18   Fail
assert(isequal(nextComb([1:16 18 19 22 23 27 44 45 46 48],50),[1:16 18 19 22 23 27 44 45 46 49]))

Assertion failed.

19   Fail
assert(isequal(nextComb([1:13 15 23 25 26 28 30 32 38 39 42 46 50],50),[1:13 15 23 25 26 28 30 32 38 39 42 47 48]))

Assertion failed.

20   Fail
assert(isequal(nextComb(1,9),2))

Assertion failed.

21   Fail
assert(isequal(nextComb(2,9),3))

Assertion failed.

22   Fail
assert(isequal(nextComb(3,9),4))

Assertion failed.

23   Fail
assert(isequal(nextComb(4,9),5))

Assertion failed.

24   Fail
assert(isequal(nextComb(5,9),6))

Assertion failed.

25   Fail
assert(isequal(nextComb(6,9),7))

Assertion failed.

26   Fail
assert(isequal(nextComb(7,9),8))

Assertion failed.

27   Fail
assert(isequal(nextComb(8,9),9))

Assertion failed.

28   Pass
assert(isequal(nextComb(9,9),9))