Cody

Solution 1590947

Submitted on 24 Jul 2018 by Srishti Saha
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 3 4 5 5 6 5 7 9 8 3]; y_correct = [0 0 0 4 0 0 6 0 0 9 0 0]; assert(isequal(your_fcn_name(x),y_correct))

a = 4 6 9 a = 4 6 9 a_t = [] arr = 1 2 3 4 arr = 0 0 0 4 rep = 4 rep_min = 4 rep = 1×0 empty double row vector arr = 0 0 0 4 a_t = 0 0 0 4 arr = 5 5 6 5 arr = 0 0 6 0 rep = 3 rep_min = 3 rep = 1×0 empty double row vector arr = 0 0 6 0 a_t = 0 0 0 4 0 0 6 0 arr = 7 9 8 3 arr = 0 9 0 0 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 9 0 0 a_t = 0 0 0 4 0 0 6 0 0 9 0 0 y = 0 0 0 4 0 0 6 0 0 9 0 0

2   Pass
x = magic(4); y_correct = [16 0 0 0 0 11 0 0 0 0 0 12 0 0 15 0]; assert(isequal(your_fcn_name(x),y_correct))

a = 16 11 12 15 a = 16 11 12 15 a_t = [] arr = 16 2 3 13 arr = 16 0 0 0 rep = 1 rep_min = 1 rep = 1×0 empty double row vector arr = 16 0 0 0 a_t = 16 0 0 0 arr = 5 11 10 8 arr = 0 11 0 0 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 11 0 0 a_t = 16 0 0 0 0 11 0 0 arr = 9 7 6 12 arr = 0 0 0 12 rep = 4 rep_min = 4 rep = 1×0 empty double row vector arr = 0 0 0 12 a_t = 16 0 0 0 0 11 0 0 0 0 0 12 arr = 4 14 15 1 arr = 0 0 15 0 rep = 3 rep_min = 3 rep = 1×0 empty double row vector arr = 0 0 15 0 a_t = 16 0 0 0 0 11 0 0 0 0 0 12 0 0 15 0 y = 16 0 0 0 0 11 0 0 0 0 0 12 0 0 15 0

3   Pass
x = pi; y_correct = pi; assert(isequal(your_fcn_name(x),y_correct))

a = 3.1416 a = 3.1416 a_t = [] arr = 3.1416 arr = 3.1416 rep = 1 rep_min = 1 rep = 1×0 empty double row vector arr = 3.1416 a_t = 3.1416 y = 3.1416

4   Pass
x = 0; y_correct = 0; assert(isequal(your_fcn_name(x),y_correct))

a = 0 a = 0 a_t = [] arr = 0 arr = 0 rep = [] rep_min = [] rep = [] arr = 0 a_t = 0 y = 0

5   Pass
x = toeplitz(1:5); y_correct = [ 0 0 0 0 5 0 0 0 0 4 3 0 0 0 0 4 0 0 0 0 5 0 0 0 0]; assert(isequal(your_fcn_name(x),y_correct))

a = 5 4 3 4 5 a = 5 4 3 4 5 a_t = [] arr = 1 2 3 4 5 arr = 0 0 0 0 5 rep = 5 rep_min = 5 rep = 1×0 empty double row vector arr = 0 0 0 0 5 a_t = 0 0 0 0 5 arr = 2 1 2 3 4 arr = 0 0 0 0 4 rep = 5 rep_min = 5 rep = 1×0 empty double row vector arr = 0 0 0 0 4 a_t = 0 0 0 0 5 0 0 0 0 4 arr = 3 2 1 2 3 arr = 3 0 0 0 3 rep = 1 5 rep_min = 1 rep = 5 arr = 3 0 0 0 0 a_t = 0 0 0 0 5 0 0 0 0 4 3 0 0 0 0 arr = 4 3 2 1 2 arr = 4 0 0 0 0 rep = 1 rep_min = 1 rep = 1×0 empty double row vector arr = 4 0 0 0 0 a_t = 0 0 0 0 5 0 0 0 0 4 3 0 0 0 0 4 0 0 0 0 arr = 5 4 3 2 1 arr = 5 0 0 0 0 rep = 1 rep_min = 1 rep = 1×0 empty double row vector arr = 5 0 0 0 0 a_t = 0 0 0 0 5 0 0 0 0 4 3 0 0 0 0 4 0 0 0 0 5 0 0 0 0 y = 0 0 0 0 5 0 0 0 0 4 3 0 0 0 0 4 0 0 0 0 5 0 0 0 0

6   Pass
x = ones(5); y_correct = [ 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0]; assert(isequal(your_fcn_name(x),y_correct))

a = 1 1 1 1 1 a = 1 1 1 1 1 a_t = [] arr = 1 1 1 1 1 arr = 1 1 1 1 1 rep = 1 2 3 4 5 rep_min = 1 rep = 2 3 4 5 arr = 1 0 0 0 0 a_t = 1 0 0 0 0 arr = 1 1 1 1 1 arr = 1 1 1 1 1 rep = 1 2 3 4 5 rep_min = 1 rep = 2 3 4 5 arr = 1 0 0 0 0 a_t = 1 0 0 0 0 1 0 0 0 0 arr = 1 1 1 1 1 arr = 1 1 1 1 1 rep = 1 2 3 4 5 rep_min = 1 rep = 2 3 4 5 arr = 1 0 0 0 0 a_t = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 arr = 1 1 1 1 1 arr = 1 1 1 1 1 rep = 1 2 3 4 5 rep_min = 1 rep = 2 3 4 5 arr = 1 0 0 0 0 a_t = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 arr = 1 1 1 1 1 arr = 1 1 1 1 1 rep = 1 2 3 4 5 rep_min = 1 rep = 2 3 4 5 arr = 1 0 0 0 0 a_t = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 y = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0

7   Pass
x =nchoosek(7:9,3); y_correct =[ 0 0 9]; assert(isequal(your_fcn_name(x),y_correct))

a = 9 a = 9 a_t = [] arr = 7 8 9 arr = 0 0 9 rep = 3 rep_min = 3 rep = 1×0 empty double row vector arr = 0 0 9 a_t = 0 0 9 y = 0 0 9

8   Pass
x =nchoosek(4:9,2); y_correct = [ 0 5 0 6 0 7 0 8 0 9 0 6 0 7 0 8 0 9 0 7 0 8 0 9 0 8 0 9 0 9]; assert(isequal(your_fcn_name(x),y_correct))

a = 5 6 7 8 9 6 7 8 9 7 8 9 8 9 9 a = 5 6 7 8 9 6 7 8 9 7 8 9 8 9 9 a_t = [] arr = 4 5 arr = 0 5 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 5 a_t = 0 5 arr = 4 6 arr = 0 6 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 6 a_t = 0 5 0 6 arr = 4 7 arr = 0 7 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 7 a_t = 0 5 0 6 0 7 arr = 4 8 arr = 0 8 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 8 a_t = 0 5 0 6 0 7 0 8 arr = 4 9 arr = 0 9 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 9 a_t = 0 5 0 6 0 7 0 8 0 9 arr = 5 6 arr = 0 6 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 6 a_t = 0 5 0 6 0 7 0 8 0 9 0 6 arr = 5 7 arr = 0 7 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 7 a_t = 0 5 0 6 0 7 0 8 0 9 0 6 0 7 arr = 5 8 arr = 0 8 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 8 a_t = 0 5 0 6 0 7 0 8 0 9 0 6 0 7 0 8 arr = 5 9 arr = 0 9 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 9 a_t = 0 5 0 6 0 7 0 8 0 9 0 6 0 7 0 8 0 9 arr = 6 7 arr = 0 7 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 7 a_t = 0 5 0 6 0 7 0 8 0 9 0 6 0 7 0 8 0 9 0 7 arr = 6 8 arr = 0 8 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 8 a_t = 0 5 0 6 0 7 0 8 0 9 0 6 0 7 0 8 0 9 0 7 0 8 arr = 6 9 arr = 0 9 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 9 a_t = 0 5 0 6 0 7 0 8 0 9 0 6 0 7 0 8 0 9 0 7 0 8 0 9 arr = 7 8 arr = 0 8 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 8 a_t = 0 5 0 6 0 7 0 8 0 9 0 6 0 7 0 8 0 9 0 7 0 8 0 9 0 8 arr = 7 9 arr = 0 9 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 9 a_t = 0 5 0 6 0 7 0 8 0 9 0 6 0 7 0 8 0 9 0 7 0 8 0 9 0 8 0 9 arr = 8 9 arr = 0 9 rep = 2 rep_min = 2 rep = 1×0 empty double row vector arr = 0 9 a_t = 0 5 0 6 0 7 0 8 0 9 0 6 0 7 0 8 0 9 0 7 0 8 0 9 0 8 0 9 0 9 y = 0 5 0 6 0 7 0 8 0 9 0 6 0 7 0 8 0 9 0 7 0 8 0 9 0 8 0 9 0 9