Cody

# Problem 1505. Perl 4: unshift

Solution 2855312

Submitted on 20 Aug 2020
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
x = [1 2 3 4 5]; y = [6 7 8]; [x, num]=unshift(x, y); y_correct = [6 7 8 1 2 3 4 5]; num_correct=8; assert(isequal(x,y_correct) & isequal(num, num_correct));

Error using unshift Too many output arguments. Error in Test1 (line 3) [x, num]=unshift(x, y);

2   Fail
x = [1 2 3 4 5]; y = 6; [x, num]=unshift(x, y); y_correct = [6 1 2 3 4 5]; num_correct = 6; assert(isequal(x,y_correct) & isequal(num, num_correct));

Error using unshift Too many output arguments. Error in Test2 (line 3) [x, num]=unshift(x, y);

3   Fail
x = [1 2 3 4 5]'; y = [6 7 8]; [x, num]=unshift(x, y); y_correct = [6 7 8 1 2 3 4 5]'; num_correct = 8; assert(isequal(x,y_correct) & isequal(num, num_correct));

Error using unshift Too many output arguments. Error in Test3 (line 3) [x, num]=unshift(x, y);

4   Fail
x = []; y = [1 2 3]; [x, num]=unshift(x, y); y_correct = [1 2 3]; num_correct = 3; assert(isequal(x,y_correct) & isequal(num, num_correct));

Error using unshift Too many output arguments. Error in Test4 (line 3) [x, num]=unshift(x, y);

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!