Cody

Solution 1900596

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))

t = 1 1 1 1 2 2 2 stride = 2

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

t = 0 0 0 1 3 3 3 3 3 3 3 4 4 5 5 6 9 9 9 9 9 stride = 9

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

t = 0 0 1 1 1 1 1 1 2 2 2 2 2 2 2 stride = 2

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

t = 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 stride = 5

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

t = 1 1 1 1 1 1 1 1 10 10 10 10 10 10 10 30 96 stride = 10

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

t = Columns 1 through 30 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Columns 31 through 60 2 2 2 2 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 Columns 61 through 79 5 6 6 6 6 6 6 6 6 6 6 6 6 6 10 10 12 12 13 stride = 12

Assertion failed.