Cody

Solution 1915725

Submitted on 29 Aug 2019 by Binbin Qi
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
assert(isequal(nextComb([1 2 3],5),[1 2 4]))

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

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

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

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

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

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

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

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

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

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

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

13   Pass
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]))

14   Pass
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]))

15   Pass
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]))

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

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

18   Pass
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]))

19   Pass
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]))

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

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

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

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

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

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

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

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

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

Suggested Problems

More from this Author57