Cody

# Problem 2031. Half-Swap

Solution 2089936

Submitted on 12 Jan 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 = [15 42 91 17 7 4]; y_correct = [17 7 4 15 42 91]; assert(isequal(your_fcn_name(x),y_correct))

Unrecognized function or variable 'n'. Error in your_fcn_name (line 2) y = [x(n/2+1:end) x(1:n/2)]; Error in Test1 (line 3) assert(isequal(your_fcn_name(x),y_correct))

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

Unrecognized function or variable 'n'. Error in your_fcn_name (line 2) y = [x(n/2+1:end) x(1:n/2)]; Error in Test2 (line 3) y = your_fcn_name(x);

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

Unrecognized function or variable 'n'. Error in your_fcn_name (line 2) y = [x(n/2+1:end) x(1:n/2)]; Error in Test3 (line 4) y = your_fcn_name(x);

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

Unrecognized function or variable 'n'. Error in your_fcn_name (line 2) y = [x(n/2+1:end) x(1:n/2)]; Error in Test4 (line 4) y = your_fcn_name(x);

### Community Treasure Hunt

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

Start Hunting!