Cody

Solution 1682652

Submitted on 29 Nov 2018 by Takeyoshi Terui
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)))

output = 1 2 3 output = 1 2 3 4 output = 1 2 3 4 5 output = 2 3 4 output = 2 3 4 5 output = 3 2 1 output = 3 4 5 output = 4 3 2 output = 4 3 2 1 output = 5 4 3 output = 5 4 3 2 output = 5 4 3 2 1

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)))

output = 1 1 2 3 8 4 5 output = 1 1 2 3 8 4 5 6 7 output = 7 6 5 4 8 3 output = 7 6 5 4 8 3 2 1 1 output = 5 4 8 3 2 1 1 output = 3 8 4 5 6 7

3   Pass
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)))

output = 2 3 1 output = 2 3 1 5 output = 2 3 1 5 9 output = 3 2 4 output = 4 2 3 output = 4 2 3 1 output = 4 2 3 1 5 output = 4 2 3 1 5 9 output = 3 1 5 output = 3 1 5 9 output = 1 3 2 output = 1 3 2 4 output = 1 5 9 output = 5 1 3 output = 5 1 3 2 output = 5 1 3 2 4 output = 9 5 1 output = 9 5 1 3 output = 9 5 1 3 2 output = 9 5 1 3 2 4 output = 2 3 1 output = 2 3 1 5 output = 2 3 1 5 9 output = 3 2 4 output = 4 2 3 output = 4 2 3 1 output = 4 2 3 1 5 output = 4 2 3 1 5 9 output = 3 1 5 output = 3 1 5 9 output = 1 3 2 output = 1 3 2 4 output = 1 5 9 output = 5 1 3 output = 5 1 3 2 output = 5 1 3 2 4 output = 9 5 1 output = 9 5 1 3 output = 9 5 1 3 2 output = 9 5 1 3 2 4

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)))

output = 10.0000 9.0000 8.0000 7.0000 6.0000 5.7500 5.5000 5.2500 5.0000 output = 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 output = 1.0000 2.0000 3.0000 4.0000 5.0000 5.2500 5.5000 5.7500 6.0000 output = 1.0000 2.0000 3.0000 4.0000 5.0000 5.2500 5.5000 5.7500 6.0000 7.0000 8.0000 9.0000 10.0000 output = 5.0000 5.2500 5.5000 5.7500 6.0000 7.0000 8.0000 9.0000 10.0000 output = 6.0000 5.7500 5.5000 5.2500 5.0000 4.0000 3.0000 2.0000 1.0000 output = 10.0000 9.0000 8.0000 7.0000 6.0000 5.7500 5.5000 5.2500 5.0000 output = 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 output = 1.0000 2.0000 3.0000 4.0000 5.0000 5.2500 5.5000 5.7500 6.0000 output = 1.0000 2.0000 3.0000 4.0000 5.0000 5.2500 5.5000 5.7500 6.0000 7.0000 8.0000 9.0000 10.0000 output = 5.0000 5.2500 5.5000 5.7500 6.0000 7.0000 8.0000 9.0000 10.0000 output = 6.0000 5.7500 5.5000 5.2500 5.0000 4.0000 3.0000 2.0000 1.0000

5   Pass
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)))

output = 24 16 8 4 2 output = 24 16 8 4 2 4 6 output = 2 4 8 16 24 output = 8 4 2 4 6 output = 6 4 2 4 8 output = 6 4 2 4 8 16 24 output = 24 16 8 4 2 output = 24 16 8 4 2 4 6 output = 2 4 8 16 24 output = 8 4 2 4 6 output = 6 4 2 4 8 output = 6 4 2 4 8 16 24

6   Pass
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)))

output = Columns 1 through 18 0.8148 0.0385 0.7099 0.2892 0.9369 0.2734 0.4867 0.7237 0.5441 0.1997 0.2491 0.2233 12.0000 0.8148 0.0385 0.7099 0.2892 0.9369 Columns 19 through 25 0.2734 0.4867 0.7237 0.5441 0.1997 0.2491 0.2233 output = 12.0000 0.2233 0.2491 0.1997 0.5441 0.7237 0.4867 0.2734 0.9369 0.2892 0.7099 0.0385 0.8148 12.0000 output = Columns 1 through 18 0.2233 0.2491 0.1997 0.5441 0.7237 0.4867 0.2734 0.9369 0.2892 0.7099 0.0385 0.8148 12.0000 0.2233 0.2491 0.1997 0.5441 0.7237 Columns 19 through 25 0.4867 0.2734 0.9369 0.2892 0.7099 0.0385 0.8148 output = 12.0000 0.8148 0.0385 0.7099 0.2892 0.9369 0.2734 0.4867 0.7237 0.5441 0.1997 0.2491 0.2233 12.0000

7   Pass
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)))

output = 8.0000 16.0000 24.0000 0.6372 0.8416 output = 24 16 8 4 2 output = 24 16 8 4 2 4 6 output = 2 4 8 16 24 output = 2.0000 4.0000 8.0000 16.0000 24.0000 0.6372 0.8416 output = 8 4 2 4 6 output = 6 4 2 4 8 output = 6 4 2 4 8 16 24 output = 6.0000 4.0000 2.0000 4.0000 8.0000 16.0000 24.0000 0.6372 0.8416 output = 0.8416 0.6372 24.0000 16.0000 8.0000 output = 0.8416 0.6372 24.0000 16.0000 8.0000 4.0000 2.0000 output = 0.8416 0.6372 24.0000 16.0000 8.0000 4.0000 2.0000 4.0000 6.0000

8   Pass
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)))

output = Columns 1 through 30 7 6 4 3 8 10 13 9 1 2 5 12 11 7 6 4 3 8 10 13 9 1 2 5 12 11 23 24 16 21 Columns 31 through 39 17 19 20 22 26 15 14 18 25 output = Columns 1 through 30 11 12 5 2 1 9 13 10 8 3 4 6 7 11 12 5 2 1 9 13 10 8 3 4 6 7 6 4 3 8 Columns 31 through 51 10 13 9 1 2 5 12 11 23 24 16 21 17 19 20 22 26 15 14 18 25 output = Columns 1 through 30 25 18 14 15 26 22 20 19 17 21 16 24 23 11 12 5 2 1 9 13 10 8 3 4 6 7 11 12 5 2 Columns 31 through 39 1 9 13 10 8 3 4 6 7