Cody

# Problem 782. Some Assembly Required

Solution 2096159

Submitted on 17 Jan 2020 by Asif Newaz
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)))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assemble_this (line 2) In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assemble_this (line 2) In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assemble_this (line 2) In ScoringEngineTestPoint2 (line 3) In solutionTest (line 5)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assemble_this (line 2) In ScoringEngineTestPoint2 (line 3) In solutionTest (line 5)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assemble_this (line 2) In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assemble_this (line 2) In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assemble_this (line 2) In ScoringEngineTestPoint4 (line 3) In solutionTest (line 9)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assemble_this (line 2) In ScoringEngineTestPoint4 (line 3) In solutionTest (line 9)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assemble_this (line 2) In ScoringEngineTestPoint5 (line 3) In solutionTest (line 11)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assemble_this (line 2) In ScoringEngineTestPoint5 (line 3) In solutionTest (line 11)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assemble_this (line 2) In ScoringEngineTestPoint6 (line 4) In solutionTest (line 13)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assemble_this (line 2) In ScoringEngineTestPoint7 (line 3) In solutionTest (line 15)]

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

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In assemble_this (line 2) In ScoringEngineTestPoint8 (line 4) In solutionTest (line 17)]