Cody

Solution 1562922

Submitted on 18 Jun 2018 by amir cohen
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
filetext = fileread('shuffle.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')

2   Pass
v = [1, 2, 3, 4, 5, 6, 7, 8]; n = 1; w_correct = 8 : -1 : 1; assert(isequal(shuffle(v, n), w_correct))

v = 1 2 3 4 5 6 7 w = 8 cetvor = 8 b = 1 v = 1 2 3 4 5 6 w = 7 cetvor = 8 7 b = 2 v = 1 2 3 4 5 w = 6 cetvor = 8 7 6 b = 3 v = 1 2 3 4 w = 5 cetvor = 8 7 6 5 b = 4 v = 1 2 3 w = 4 cetvor = 8 7 6 5 4 b = 5 v = 1 2 w = 3 cetvor = 8 7 6 5 4 3 b = 6 v = 1 w = 2 cetvor = 8 7 6 5 4 3 2 b = 7 v = 1×0 empty double row vector w = 1 cetvor = 8 7 6 5 4 3 2 1 b = 8

3   Pass
v = [1; 2; 3; 4; 5; 6; 7; 8]; n = 2; w_correct = [7;8; 5;6; 3;4; 1;2]; assert(isequal(shuffle(v, n), w_correct))

v = 1 2 3 4 5 6 w = 7 8 cetvor = 7 8 b = 2 v = 1 2 3 4 w = 5 6 cetvor = 7 8 5 6 b = 4 v = 1 2 w = 3 4 cetvor = 7 8 5 6 3 4 b = 6 v = 0×1 empty double column vector w = 1 2 cetvor = 7 8 5 6 3 4 1 2 b = 8

4   Pass
v = [1, 2, 3, 4, 5, 6, 7, 8]; n = 3; w_correct = [6,7,8, 3,4,5, 1,2]; assert(isequal(shuffle(v, n), w_correct))

v = 1 2 3 4 5 w = 6 7 8 cetvor = 6 7 8 b = 3 v = 1 2 w = 3 4 5 cetvor = 6 7 8 3 4 5 b = 6 v = [] w = 1 2 cetvor = 6 7 8 3 4 5 1 2 b = 8

5   Pass
v = [1; 2; 3; 4; 5; 6; 7; 8]; n = 4; w_correct = [5;6;7;8; 1;2;3;4]; assert(isequal(shuffle(v, n), w_correct))

v = 1 2 3 4 w = 5 6 7 8 cetvor = 5 6 7 8 b = 4 v = 0×1 empty double column vector w = 1 2 3 4 cetvor = 5 6 7 8 1 2 3 4 b = 8

6   Pass
v = [1, 2, 3, 4, 5, 6, 7, 8]; n = 5; w_correct = [4,5,6,7,8, 1,2,3]; assert(isequal(shuffle(v, n), w_correct))

v = 1 2 3 w = 4 5 6 7 8 cetvor = 4 5 6 7 8 b = 5 v = [] w = 1 2 3 cetvor = 4 5 6 7 8 1 2 3 b = 8

7   Pass
v = [1; 2; 3; 4; 5; 6; 7; 8]; n = 6; w_correct = [3;4;5;6;7;8; 1;2]; assert(isequal(shuffle(v, n), w_correct))

v = 1 2 w = 3 4 5 6 7 8 cetvor = 3 4 5 6 7 8 b = 6 v = [] w = 1 2 cetvor = 3 4 5 6 7 8 1 2 b = 8

8   Pass
v = [1, 2, 3, 4, 5, 6, 7, 8]; n = 7; w_correct = [2,3,4,5,6,7,8, 1]; assert(isequal(shuffle(v, n), w_correct))

v = 1 w = 2 3 4 5 6 7 8 cetvor = 2 3 4 5 6 7 8 b = 7 v = [] w = 1 cetvor = 2 3 4 5 6 7 8 1 b = 8

9   Pass
v = [1; 2; 3; 4; 5; 6; 7; 8]; n = 8; w_correct = [1;2;3;4;5;6;7;8]; assert(isequal(shuffle(v, n), w_correct))

v = 0×1 empty double column vector w = 1 2 3 4 5 6 7 8 cetvor = 1 2 3 4 5 6 7 8 b = 8

10   Pass
v = [1, 2, 3, 4, 5, 6, 7, 8]; n = 9; w_correct = [1,2,3,4,5,6,7,8]; assert(isequal(shuffle(v, n), w_correct))

v = [] w = 1 2 3 4 5 6 7 8 cetvor = 1 2 3 4 5 6 7 8 b = 8