Cody

# Problem 1986. Another colon problem

Solution 1943162

Submitted on 19 Sep 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   Fail
assert(isequal(another([1 8 12],[4 5 9]),[1 2 3 4 8 7 6 5 12 11 10 9]))

Index exceeds the number of array elements (1). Error in another (line 4) i2 = in2(2); Error in another (line 8) out = [i1:i2 another(in1(2:end),in2(2:end))] Error in another (line 8) out = [i1:i2 another(in1(2:end),in2(2:end))] Error in Test1 (line 1) assert(isequal(another([1 8 12],[4 5 9]),[1 2 3 4 8 7 6 5 12 11 10 9]))

2   Fail
assert(isequal(another([5 5 5],[9 5 1]),[5 6 7 8 9 5 5 4 3 2 1]))

Index exceeds the number of array elements (1). Error in another (line 4) i2 = in2(2); Error in another (line 6) out = [i1:-1:i2 another(in1(2:end),in2(2:end))] Error in another (line 8) out = [i1:i2 another(in1(2:end),in2(2:end))] Error in Test2 (line 1) assert(isequal(another([5 5 5],[9 5 1]),[5 6 7 8 9 5 5 4 3 2 1]))

3   Fail
assert(isequal(another([100 102],[-1 105]),[100:-1:-1 102 103 104 105]))

Index exceeds the number of array elements (1). Error in another (line 4) i2 = in2(2); Error in another (line 8) out = [i1:i2 another(in1(2:end),in2(2:end))] Error in Test3 (line 1) assert(isequal(another([100 102],[-1 105]),[100:-1:-1 102 103 104 105]))

4   Fail
y=[randi(20) randi([30 40],1,2) randi(3)]; assert(isequal(another(y(1:2:3),y(2:2:4)),[y(1):y(2) y(3):-1:y(4)]))

Index exceeds the number of array elements (1). Error in another (line 4) i2 = in2(2); Error in another (line 6) out = [i1:-1:i2 another(in1(2:end),in2(2:end))] Error in Test4 (line 2) assert(isequal(another(y(1:2:3),y(2:2:4)),[y(1):y(2) y(3):-1:y(4)]))

5   Fail
assert(isequal(another([1 2 1 2 2 2 1 1 1],[1 2 1 1 2 1 2 2 1]),[1 2 1 2 1 2 2 1 1 2 1 2 1]))

Index exceeds the number of array elements (1). Error in another (line 4) i2 = in2(2); Error in another (line 8) out = [i1:i2 another(in1(2:end),in2(2:end))] Error in another (line 8) out = [i1:i2 another(in1(2:end),in2(2:end))] Error in another (line 8) out = [i1:i2 another(in1(2:end),in2(2:end))] Error in another (line 6) out = [i1:-1:i2 another(in1(2:end),in2(2:end))] Error in another (line 8) out = [i1:i2 another(in1(2:end),in2(2:end))] Error in another (line 8) out = [i1:i2 another(in1(2:end),in2(2:end))] Error in another (line 6) out = [i1:-1:i2 another(in1(2:end),in2(2:end))] Error in another (line 8) out = [i1:i2 another(in1(2:end),in2(2:end))] Error in Test5 (line 1) assert(isequal(another([1 2 1 2 2 2 1 1 1],[1 2 1 1 2 1 2 2 1]),[1 2 1 2 1 2 2 1 1 2 1 2 1]))