Cody

Solution 1498578

Submitted on 20 Apr 2018 by Ruud van de Looij
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)))

y_temp = 1 2 3 remove_row = 1 y_temp = 1 2 3 4 remove_row = 1 y_temp = 1 2 3 4 5 remove_row = 1 y = 1 2 3 4 5 y_temp = 1 2 3 remove_row = 1 y_temp = 1 2 3 4 remove_row = 1 y_temp = 1 2 3 4 5 remove_row = 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)))

y_temp = 1 1 2 3 8 4 5 remove_row = 2 y_temp = 1 1 2 3 8 4 5 6 7 remove_row = 1 y = 1 1 2 3 8 4 5 6 7 y_temp = 1 1 2 3 8 4 5 remove_row = 2 y_temp = 1 1 2 3 8 4 5 6 7 remove_row = 1

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

y_temp = 3 2 4 remove_row = 1 y_temp = 4 2 3 1 remove_row = 1 y_temp = 4 2 3 1 5 remove_row = 1 y_temp = 4 2 3 1 5 9 remove_row = 1 y = 4 2 3 1 5 9 y_temp = 2 3 1 remove_row = 2 y_temp = 2 3 1 5 remove_row = 2 y_temp = 2 3 1 5 9 remove_row = 2 y_temp = 9 5 1 3 2 4 remove_row = 1 y_temp = 3 2 4 remove_row = 1 y_temp = 4 2 3 1 remove_row = 1 y_temp = 4 2 3 1 5 remove_row = 1 y_temp = 4 2 3 1 5 9 remove_row = 1 y = 4 2 3 1 5 9 y_temp = 2 3 1 remove_row = 2 y_temp = 2 3 1 5 remove_row = 2 y_temp = 2 3 1 5 9 remove_row = 2 y_temp = 9 5 1 3 2 4 remove_row = 1

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

y_temp = 10.0000 9.0000 8.0000 7.0000 6.0000 5.7500 5.5000 5.2500 5.0000 remove_row = 2 y_temp = 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 remove_row = 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 y_temp = 10.0000 9.0000 8.0000 7.0000 6.0000 5.7500 5.5000 5.2500 5.0000 remove_row = 2 y_temp = 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 remove_row = 1 y_temp = 10.0000 9.0000 8.0000 7.0000 6.0000 5.7500 5.5000 5.2500 5.0000 remove_row = 2 y_temp = 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 remove_row = 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 y_temp = 10.0000 9.0000 8.0000 7.0000 6.0000 5.7500 5.5000 5.2500 5.0000 remove_row = 2 y_temp = 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 remove_row = 1

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

y_temp = 24 16 8 4 2 remove_row = 1 y_temp = 24 16 8 4 2 4 6 remove_row = 1 y = 6 4 2 4 8 16 24 y_temp = 24 16 8 4 2 remove_row = 1 y_temp = 24 16 8 4 2 4 6 remove_row = 1

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

y_temp = 12.0000 0.3003 0.2089 0.4021 0.1609 0.1128 0.3778 0.1767 0.7591 0.2602 0.8707 0.8264 0.5434 12.0000 remove_row = 1 y = 12.0000 0.5434 0.8264 0.8707 0.2602 0.7591 0.1767 0.3778 0.1128 0.1609 0.4021 0.2089 0.3003 12.0000 y_temp = Columns 1 through 17 0.5434 0.8264 0.8707 0.2602 0.7591 0.1767 0.3778 0.1128 0.1609 0.4021 0.2089 0.3003 12.0000 0.5434 0.8264 0.8707 0.2602 Columns 18 through 25 0.7591 0.1767 0.3778 0.1128 0.1609 0.4021 0.2089 0.3003 remove_row = 1

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

y_temp = 24 16 8 4 2 remove_row = 1 y_temp = 24 16 8 4 2 4 6 remove_row = 1 y_temp = 6.0000 4.0000 2.0000 4.0000 8.0000 16.0000 24.0000 0.7849 0.8981 remove_row = 1 y = 6.0000 4.0000 2.0000 4.0000 8.0000 16.0000 24.0000 0.7849 0.8981 y_temp = 8.0000 16.0000 24.0000 0.7849 0.8981 remove_row = 3 y_temp = 0.8981 0.7849 24.0000 16.0000 8.0000 4.0000 2.0000 remove_row = 1 y_temp = 0.8981 0.7849 24.0000 16.0000 8.0000 4.0000 2.0000 4.0000 6.0000 remove_row = 1

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

y_temp = Columns 1 through 29 4 5 8 10 2 7 9 1 6 3 11 4 5 8 10 2 7 9 1 6 3 11 3 6 1 9 7 2 10 Columns 30 through 43 8 5 4 19 16 22 14 21 20 17 13 15 18 12 remove_row = 1 y = Columns 1 through 29 12 18 15 13 17 20 21 14 22 16 19 4 5 8 10 2 7 9 1 6 3 11 3 6 1 9 7 2 10 Columns 30 through 43 8 5 4 11 3 6 1 9 7 2 10 8 5 4 y_temp = Columns 1 through 29 11 3 6 1 9 7 2 10 8 5 4 11 3 6 1 9 7 2 10 8 5 4 19 16 22 14 21 20 17 Columns 30 through 33 13 15 18 12 remove_row = 1 y = Columns 1 through 29 12 18 15 13 17 20 21 14 22 16 19 4 5 8 10 2 7 9 1 6 3 11 4 5 8 10 2 7 9 Columns 30 through 33 1 6 3 11