Cody

Solution 2640892

Submitted on 1 Jul 2020 by Ramesh Kumar V
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
n=10 x = randperm(n); y_correct = [2 4 6 8 10]; assert(isequal(rmv_srt(n),y_correct))

n = 10 x = 4 3 2 8 1 6 10 9 5 7 x1 = 1 2 3 4 5 6 7 8 9 10 ind = 1×10 logical array 1 0 1 0 1 0 1 0 1 0 x1 = 2 4 6 8 10

2   Pass
n=25 x = randperm(n); y_correct = [2 4 6 8 10 12 14 16 18 20 22 24]; assert(isequal(rmv_srt(n),y_correct))

n = 25 x = 24 12 10 9 4 5 25 1 17 18 13 3 2 19 8 11 16 6 23 7 20 22 21 14 15 x1 = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ind = 1×25 logical array 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 x1 = 2 4 6 8 10 12 14 16 18 20 22 24

Suggested Problems

More from this Author8