Cody

# Problem 45303. Combinatorics - 01

Solution 2188938

Submitted on 2 Apr 2020 by Binbin Qi
• Size: 93
• This is the leading solution.
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
x = [1,2]; n=6; y_correct = [ 1 1 1 2 2 2 1 1 2 1 2 2 1 1 2 2 1 2 1 2 1 1 2 2 1 2 1 2 1 2 1 2 1 2 2 1 2 1 1 1 2 2 2 1 1 2 1 2 2 1 1 2 2 1 2 1 2 1 1 2 2 1 2 1 2 1 2 1 2 2 1 1 2 2 1 1 1 2 2 2 1 1 2 1 2 2 2 1 1 1]; assert(isequal(combin(x,n),y_correct))

2   Pass
x = [2,1]; n=6; y_correct = [2 2 2 1 1 1 2 2 1 2 1 1 2 2 1 1 2 1 2 1 2 2 1 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 2 2 1 1 1 2 2 1 2 1 1 2 2 1 1 2 1 2 1 2 2 1 1 2 1 2 1 2 1 2 1 1 2 2 1 1 2 2 2 1 1 1 2 2 1 2 1 1 1 2 2 2]; assert(isequal(combin(x,n),y_correct))

3   Pass
x = [5,9]; n=4; y_correct = [5 5 9 9 5 9 5 9 9 5 5 9 9 5 9 5 9 9 5 5]; assert(isequal(combin(x,n),y_correct))

4   Pass
x = [5,9]; n=2; y_correct = [5 9 9 5]; assert(isequal(combin(x,n),y_correct))

5   Pass
x = [5,9]; n=8; y_correct = [5 5 5 5 9 9 9 9 5 5 5 9 5 9 9 9 5 5 5 9 9 5 9 9 5 5 5 9 9 9 5 9 5 5 9 5 5 9 9 9 5 5 9 5 9 5 9 9 5 5 9 5 9 9 5 9 5 5 9 5 9 9 9 5 5 5 9 9 5 5 9 9 5 5 9 9 5 9 5 9 5 5 9 9 5 9 9 5 5 9 5 5 5 9 9 9 5 9 5 5 9 5 9 9 5 9 5 5 9 9 5 9 5 9 5 5 9 9 9 5 5 9 5 9 5 5 9 9 5 9 5 9 5 9 5 9 5 9 5 9 5 9 9 5 5 9 5 9 9 5 5 9 5 9 5 9 9 5 9 5 5 9 5 9 9 9 5 5 9 5 5 5 5 9 9 9 9 5 5 5 9 5 9 9 9 5 5 5 9 9 5 9 9 5 5 5 9 9 9 5 9 5 5 9 5 5 9 9 9 5 5 9 5 9 5 9 9 5 5 9 5 9 9 5 9 5 5 9 9 5 5 9 9 5 5 9 9 5 9 5 9 5 5 9 9 9 5 5 9 5 9 5 5 5 9 9 9 5 9 5 5 9 5 9 9 5 9 5 5 9 9 5 9 5 9 5 9 5 5 9 9 5 9 5 9 5 9 5 9 5 9 5 9 9 5 5 9 5 9 9 5 5 5 9 9 5 9 9 5 5 9 5 9 5 9 9 5 9 5 5 9 5 9 9 9 5 5 5 9 9 5 5 5 5 9 9 9 9 5 5 5 9 5 9 9 9 5 5 5 9 9 5 9 9 5 5 9 5 5 9 9 9 5 5 9 5 9 5 9 9 5 5 9 9 5 5 9 9 9 5 5 5 5 9 9 9 9 5 5 5 9 5 9 9 9 9 5 5 5 5]; assert(isequal(combin(x,n),y_correct))