Cody

# Problem 2031. Half-Swap

Solution 1818128

Submitted on 16 May 2019 by Zoltán Nagy
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 = [15 42 91 17 7 4]; y_correct = [17 7 4 15 42 91]; assert(isequal(your_fcn_name(x),y_correct))

z = 17 7 4 x = 15 42 91 15 42 91 x = 17 7 4 15 42 91 y = 17 7 4 15 42 91

2   Pass
x = [2 10]; y_correct = [10 2]; y = your_fcn_name(x); assert(isequal(y_correct,y))

z = 10 x = 2 2 x = 10 2 y = 10 2

3   Pass
x = [27 1 13 11 22 23 6 14]; y_correct = [22 23 6 14 27 1 13 11]; y = your_fcn_name(x); assert(isequal(y_correct,y))

z = 22 23 6 14 x = 27 1 13 11 27 1 13 11 x = 22 23 6 14 27 1 13 11 y = 22 23 6 14 27 1 13 11

4   Pass
x = [13 14 5 13 12 3 3 9 18 7 11 5 14 5]; y_correct = [9 18 7 11 5 14 5 13 14 5 13 12 3 3]; y = your_fcn_name(x); assert(isequal(y_correct,y))

z = 9 18 7 11 5 14 5 x = 13 14 5 13 12 3 3 13 14 5 13 12 3 3 x = 9 18 7 11 5 14 5 13 14 5 13 12 3 3 y = 9 18 7 11 5 14 5 13 14 5 13 12 3 3

### Community Treasure Hunt

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

Start Hunting!