Cody

Solution 1707320

Submitted on 15 Jan 2019 by Nikolaos Nikolaou
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))

n = 5 v = 1 2 3 4 5 s = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 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))

n = 3 v = 1 2 3 s = 0 0 0 0 0 0 0 0 0 y = 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))

n = 4 v = 1 2 3 4 s = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 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))

n = 7 v = 1 2 3 4 5 6 7 s = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 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))

n = 6 v = 1 2 3 4 5 6 s = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 y = 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

Suggested Problems

More from this Author10