Cody

Solution 1900573

Submitted on 15 Aug 2019
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
a = [1 5 3 11 7 2 4 9]; stride = 2; assert(isequal(skip_sequence_stride(a),stride))

m = 1 m = 2 m = 3 m = 4 m = 5 m = 6 m = 7 stride = 2

2   Pass
a = [1:5:20 23:3:42 2:9:100]; stride = 9; assert(isequal(skip_sequence_stride(a),stride))

m = 1 m = 2 m = 3 m = 4 m = 5 m = 6 m = 7 m = 8 m = 9 m = 10 m = 11 m = 12 m = 13 m = 14 m = 15 m = 16 m = 17 m = 18 m = 19 m = 20 m = 21 stride = 9

3   Pass
a = [2:2:22 13:17]; a = a(randperm(length(a))); stride = 2; assert(isequal(skip_sequence_stride(a),stride))

m = 1 m = 2 m = 3 m = 4 m = 5 m = 6 m = 7 m = 8 m = 9 m = 10 m = 11 m = 12 m = 13 m = 14 m = 15 stride = 2

4   Pass
a = 37:5:120; a = a(randperm(length(a))); stride = 5; assert(isequal(skip_sequence_stride(a),stride))

m = 1 m = 2 m = 3 m = 4 m = 5 m = 6 m = 7 m = 8 m = 9 m = 10 m = 11 m = 12 m = 13 m = 14 m = 15 m = 16 stride = 5

5   Fail
a = [1:5 101:10:171 201:205]; a = a(randperm(length(a))); stride = 10; assert(isequal(skip_sequence_stride(a),stride))

m = 1 m = 2 m = 3 m = 4 m = 5 m = 6 m = 7 m = 8 m = 9 m = 10 m = 11 m = 12 m = 13 m = 14 m = 15 m = 16 m = 17 stride = 96

Assertion failed.

6   Fail
a = [7:17:302 primes(300)]; a = sort(a); stride = 17; assert(isequal(skip_sequence_stride(a),stride))

m = 1 m = 2 m = 3 m = 4 m = 5 m = 6 m = 7 m = 8 m = 9 m = 10 m = 11 m = 12 m = 13 m = 14 m = 15 m = 16 m = 17 m = 18 m = 19 m = 20 m = 21 m = 22 m = 23 m = 24 m = 25 m = 26 m = 27 m = 28 m = 29 m = 30 m = 31 m = 32 m = 33 m = 34 m = 35 m = 36 m = 37 m = 38 m = 39 m = 40 m = 41 m = 42 m = 43 m = 44 m = 45 m = 46 m = 47 m = 48 m = 49 m = 50 m = 51 m = 52 m = 53 m = 54 m = 55 m = 56 m = 57 m = 58 m = 59 m = 60 m = 61 m = 62 m = 63 m = 64 m = 65 m = 66 m = 67 m = 68 m = 69 m = 70 m = 71 m = 72 m = 73 m = 74 m = 75 m = 76 m = 77 m = 78 m = 79 stride = 13

Assertion failed.