Cody

Solution 2037546

Submitted on 28 Nov 2019
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 ; 2 3 ; 3 4 ; 4 5]; y_correct=[1 2 3 4 5]; assert(isequal(assemble_this(x),y_correct)||isequal(assemble_this(x),fliplr(y_correct)))

c = 2 d = 1 y = 1 2 3 c = 3 d = 1 y = 1 2 3 4 c = 4 d = 1 y = 1 2 3 4 5

2   Pass
x= [1 1 2 3 ; 4 5 6 7 ; 5 4 8 3]; y_correct=[1 1 2 3 8 4 5 6 7]; assert(isequal(assemble_this(x),y_correct)||isequal(assemble_this(x),fliplr(y_correct)))

c = 1×0 empty double row vector c = 3 d = 4 x = 1 1 2 3 4 5 6 7 3 8 4 5 d = 1 y = 1 1 2 3 8 4 5 c = 4 5 d = 2 y = 1 1 2 3 8 4 5 6 7

3   Fail
x=[2 3 ; 4 2 ; 3 1 ; 1 5 ; 5 9]; y_correct=[9 5 1 3 2 4]; assert(isequal(assemble_this(x),y_correct)||isequal(assemble_this(x),fliplr(y_correct)))

c = 2 d = 2 x = 2 3 2 4 3 1 1 5 5 9 d = 1 y = 2 3 4 c = 3 d = 1 y = 2 3 4 1 c = 1 d = 1 y = 2 3 4 1 5 c = 5 d = 1 y = 2 3 4 1 5 9 c = 2 d = 2 x = 2 3 2 4 3 1 1 5 5 9 d = 1 y = 2 3 4 c = 3 d = 1 y = 2 3 4 1 c = 1 d = 1 y = 2 3 4 1 5 c = 5 d = 1 y = 2 3 4 1 5 9

Assertion failed.

4   Pass
x=[10:-1:6 ; 1:5 ; 5:0.25:6]; y_correct=[1:4 5:0.25:6 7:10]; assert(isequal(assemble_this(x),y_correct)||isequal(assemble_this(x),fliplr(y_correct)))

c = 1×0 empty double row vector c = 6 d = 5 x = 10.0000 9.0000 8.0000 7.0000 6.0000 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 5.7500 5.5000 5.2500 5.0000 d = 1 y = 10.0000 9.0000 8.0000 7.0000 6.0000 5.7500 5.5000 5.2500 5.0000 c = 5 d = 5 x = 10.0000 9.0000 8.0000 7.0000 6.0000 5.0000 4.0000 3.0000 2.0000 1.0000 6.0000 5.7500 5.5000 5.2500 5.0000 d = 1 y = 10.0000 9.0000 8.0000 7.0000 6.0000 5.7500 5.5000 5.2500 5.0000 4.0000 3.0000 2.0000 1.0000 c = 1×0 empty double row vector c = 6 d = 5 x = 10.0000 9.0000 8.0000 7.0000 6.0000 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 5.7500 5.5000 5.2500 5.0000 d = 1 y = 10.0000 9.0000 8.0000 7.0000 6.0000 5.7500 5.5000 5.2500 5.0000 c = 5 d = 5 x = 10.0000 9.0000 8.0000 7.0000 6.0000 5.0000 4.0000 3.0000 2.0000 1.0000 6.0000 5.7500 5.5000 5.2500 5.0000 d = 1 y = 10.0000 9.0000 8.0000 7.0000 6.0000 5.7500 5.5000 5.2500 5.0000 4.0000 3.0000 2.0000 1.0000

5   Fail
x=[8 16 24 ; 2 4 8 ; 6 4 2]; y_correct=[6 4 2 4 8 16 24]; assert(isequal(assemble_this(x),y_correct)||isequal(assemble_this(x),fliplr(y_correct)))

c = 8 d = 3 x = 8 16 24 8 4 2 6 4 2 d = 1 y = 8 16 24 4 2 c = 2 4

Matrix dimensions must agree. Error in assemble_this (line 8) d=find(x(i,:)==c) Error in Test5 (line 3) assert(isequal(assemble_this(x),y_correct)||isequal(assemble_this(x),fliplr(y_correct)))

6   Fail
y=ceil(rand*7)+5; ry=[rand(1,y) y]; fry=fliplr([y ry(1:end-1)]); atf=assemble_this([fry ; ry]); y_correct=[y fry]; assert(isequal(atf,y_correct)||isequal(atf,fliplr(y_correct)))

c = 0.0116 0.4482 0.5551 0.6109 0.6318 0.8034 0.8616 7.0000 d = 8 x = 0.0116 0.4482 0.8034 0.5551 0.8616 0.6318 0.6109 7.0000 7.0000 0.0116 0.4482 0.8034 0.5551 0.8616 0.6318 0.6109 d = 1×0 empty double row vector y = 0.0116 0.4482 0.8034 0.5551 0.8616 0.6318 0.6109 7.0000

Assertion failed.

7   Fail
t=rand(1,2); x=[8 16 24 ; 2 4 8 ; 6 4 2 ; 24 t]; at=assemble_this(x); y_correct=[fliplr(t) 24 16 8 4 2 4 6]; assert(isequal(at,y_correct)||isequal(at,fliplr(y_correct)))

c = 8 d = 3 x = 8.0000 16.0000 24.0000 8.0000 4.0000 2.0000 6.0000 4.0000 2.0000 24.0000 0.9025 0.8796 d = 1 y = 8 16 24 4 2 c = 2 4

Matrix dimensions must agree. Error in assemble_this (line 8) d=find(x(i,:)==c) Error in Test7 (line 3) at=assemble_this(x);

8   Fail
k=5+ceil(8*rand); x=randperm(k); y=randperm(k)+k; at=assemble_this([x x ; x y]); y_correct=[x x y]; assert(isequal(at,y_correct)||isequal(at,fliplr(y_correct)))

c = 1 2 3 4 5 6 7 8 9 10 11 12 13

Matrix dimensions must agree. Error in assemble_this (line 8) d=find(x(i,:)==c) Error in Test8 (line 4) at=assemble_this([x x ; x y]);