Cody

Solution 2217138

Submitted on 17 Apr 2020 by Atsushi Ueno
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:5)'; y_correct = [1 5 4 3 2;2 1 5 4 3;3 2 1 5 4;4 3 2 1 5;5 4 3 2 1]; assert(isequal(shifted(x),y_correct))

ans = 6 5 4 3 2 7 6 5 4 3 8 7 6 5 4 9 8 7 6 5 10 9 8 7 6 ans = 1 0 4 3 2 2 1 0 4 3 3 2 1 0 4 4 3 2 1 0 0 4 3 2 1 ans = 1 5 4 3 2 2 1 5 4 3 3 2 1 5 4 4 3 2 1 5 5 4 3 2 1

2   Pass
x = (1:3)'; y_correct = [1 3 2;2 1 3;3 2 1]; assert(isequal(shifted(x),y_correct))

ans = 4 3 2 5 4 3 6 5 4 ans = 1 0 2 2 1 0 0 2 1 ans = 1 3 2 2 1 3 3 2 1

3   Pass
x = (1:4)'; y_correct = [1 4 3 2;2 1 4 3;3 2 1 4;4 3 2 1]; assert(isequal(shifted(x),y_correct))

ans = 5 4 3 2 6 5 4 3 7 6 5 4 8 7 6 5 ans = 1 0 3 2 2 1 0 3 3 2 1 0 0 3 2 1 ans = 1 4 3 2 2 1 4 3 3 2 1 4 4 3 2 1

4   Pass
x = (1:7)'; y_correct = [1 7 6 5 4 3 2;2 1 7 6 5 4 3;3 2 1 7 6 5 4;... 4 3 2 1 7 6 5;5 4 3 2 1 7 6; 6 5 4 3 2 1 7; 7 6 5 4 3 2 1]; assert(isequal(shifted(x),y_correct))

ans = 8 7 6 5 4 3 2 9 8 7 6 5 4 3 10 9 8 7 6 5 4 11 10 9 8 7 6 5 12 11 10 9 8 7 6 13 12 11 10 9 8 7 14 13 12 11 10 9 8 ans = 1 0 6 5 4 3 2 2 1 0 6 5 4 3 3 2 1 0 6 5 4 4 3 2 1 0 6 5 5 4 3 2 1 0 6 6 5 4 3 2 1 0 0 6 5 4 3 2 1 ans = 1 7 6 5 4 3 2 2 1 7 6 5 4 3 3 2 1 7 6 5 4 4 3 2 1 7 6 5 5 4 3 2 1 7 6 6 5 4 3 2 1 7 7 6 5 4 3 2 1

5   Pass
x = (1:6)'; y_correct = [1 6 5 4 3 2;2 1 6 5 4 3;3 2 1 6 5 4;... 4 3 2 1 6 5;5 4 3 2 1 6; 6 5 4 3 2 1]; assert(isequal(shifted(x),y_correct))

ans = 7 6 5 4 3 2 8 7 6 5 4 3 9 8 7 6 5 4 10 9 8 7 6 5 11 10 9 8 7 6 12 11 10 9 8 7 ans = 1 0 5 4 3 2 2 1 0 5 4 3 3 2 1 0 5 4 4 3 2 1 0 5 5 4 3 2 1 0 0 5 4 3 2 1 ans = 1 6 5 4 3 2 2 1 6 5 4 3 3 2 1 6 5 4 4 3 2 1 6 5 5 4 3 2 1 6 6 5 4 3 2 1