Cody

Solution 1635022

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   Pass
x = 1; y_correct = 1; assert(isequal(union_jack(x),y_correct))

X = 1 Y = 1 y = logical 1

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

Operands to the || and && operators must be convertible to logical scalar values. Error in union_jack (line 3) y=(X==Y)||((n-X+1)==Y)||(X==ceil(n/2))||(Y==ceil(n/2)) Error in Test2 (line 3) assert(isequal(union_jack(x),y_correct))

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

Operands to the || and && operators must be convertible to logical scalar values. Error in union_jack (line 3) y=(X==Y)||((n-X+1)==Y)||(X==ceil(n/2))||(Y==ceil(n/2)) 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

Operands to the || and && operators must be convertible to logical scalar values. Error in union_jack (line 3) y=(X==Y)||((n-X+1)==Y)||(X==ceil(n/2))||(Y==ceil(n/2)) 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

Operands to the || and && operators must be convertible to logical scalar values. Error in union_jack (line 3) y=(X==Y)||((n-X+1)==Y)||(X==ceil(n/2))||(Y==ceil(n/2)) Error in Test5 (line 11) assert(isequal(union_jack(x),y_correct))