Cody

Solution 1635024

Submitted on 28 Sep 2018
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
x = 1; y_correct = 1; assert(isequal(union_jack(x),y_correct))

X = 1 Y = 1 y = 4 y = 4

Assertion failed.

2   Fail
x = 3; y_correct = ones(3); assert(isequal(union_jack(x),y_correct))

X = 1 2 3 1 2 3 1 2 3 Y = 1 1 1 2 2 2 3 3 3 y = 1 1 1 1 4 1 1 1 1 y = 1 1 1 1 4 1 1 1 1

Assertion failed.

3   Fail
x = 5; y_correct = [1,0,1,0,1; 0,1,1,1,0; 1,1,1,1,1; 0,1,1,1,0; 1,0,1,0,1]; assert(isequal(union_jack(x),y_correct))

X = 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 Y = 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 y = 1 0 1 0 1 0 1 1 1 0 1 1 4 1 1 0 1 1 1 0 1 0 1 0 1

Unable to perform assignment because the left and right sides have a different number of elements. Error in union_jack (line 4) y(y>0)=y Error in Test3 (line 7) assert(isequal(union_jack(x),y_correct))

4   Fail
x = 7; y_correct = [1,0,0,1,0,0,1; 0,1,0,1,0,1,0; 0,0,1,1,1,0,0; 1,1,1,1,1,1,1; 0,0,1,1,1,0,0; 0,1,0,1,0,1,0; 1,0,0,1,0,0,1]; assert(isequal(union_jack(x),y_correct))

X = 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 Y = 1 1 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 6 6 6 6 6 6 6 7 7 7 7 7 7 7 y = 1 0 0 1 0 0 1 0 1 0 1 0 1 0 0 0 1 1 1 0 0 1 1 1 4 1 1 1 0 0 1 1 1 0 0 0 1 0 1 0 1 0 1 0 0 1 0 0 1

Unable to perform assignment because the left and right sides have a different number of elements. Error in union_jack (line 4) y(y>0)=y Error in Test4 (line 9) assert(isequal(union_jack(x),y_correct))

5   Fail
x = 9; y_correct = [1,0,0,0,1,0,0,0,1; 0,1,0,0,1,0,0,1,0; 0,0,1,0,1,0,1,0,0; 0,0,0,1,1,1,0,0,0; 1,1,1,1,1,1,1,1,1; 0,0,0,1,1,1,0,0,0; 0,0,1,0,1,0,1,0,0; 0,1,0,0,1,0,0,1,0; 1,0,0,0,1,0,0,0,1]; assert(isequal(union_jack(x),y_correct))

X = 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 Y = 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 y = 1 0 0 0 1 0 0 0 1 0 1 0 0 1 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 4 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 1 0 1 0 1 0 0 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0 0 0 1

Unable to perform assignment because the left and right sides have a different number of elements. Error in union_jack (line 4) y(y>0)=y Error in Test5 (line 11) assert(isequal(union_jack(x),y_correct))