Cody

Solution 1898133

Submitted on 12 Aug 2019 by jack walker
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))

i = 1 tt = 5 4 3 2 1 1 1 1 stri = 5 i = 2 tt = 5 4 3 2 1 1 1 1 6 2 5 1 4 3 2 1 stri = 5 6 i = 3 tt = 5 4 3 2 1 1 1 1 6 2 5 1 4 3 2 1 3 2 1 2 1 1 1 1 stri = 5 6 6 i = 4 tt = 5 4 3 2 1 1 1 1 6 2 5 1 4 3 2 1 3 2 1 2 1 1 1 1 3 1 3 1 2 2 1 1 stri = 5 6 6 6 i = 5 tt = 5 4 3 2 1 1 1 1 6 2 5 1 4 3 2 1 3 2 1 2 1 1 1 1 3 1 3 1 2 2 1 1 1 2 1 2 1 1 1 1 stri = 5 6 6 6 6 i = 6 tt = 5 4 3 2 1 1 1 1 6 2 5 1 4 3 2 1 3 2 1 2 1 1 1 1 3 1 3 1 2 2 1 1 1 2 1 2 1 1 1 1 2 1 2 1 2 1 1 1 stri = 5 6 6 6 6 6 i = 7 tt = 5 4 3 2 1 1 1 1 6 2 5 1 4 3 2 1 3 2 1 2 1 1 1 1 3 1 3 1 2 2 1 1 1 2 1 2 1 1 1 1 2 1 2 1 2 1 1 1 1 2 1 2 1 1 1 1 stri = 5 6 6 6 6 6 6 i = 8 tt = 5 4 3 2 1 1 1 1 6 2 5 1 4 3 2 1 3 2 1 2 1 1 1 1 3 1 3 1 2 2 1 1 1 2 1 2 1 1 1 1 2 1 2 1 2 1 1 1 1 2 1 2 1 1 1 1 2 1 2 1 1 1 1 1 stri = 5 6 6 6 6 6 6 6 i = 9 tt = 5 4 3 2 1 1 1 1 6 2 5 1 4 3 2 1 3 2 1 2 1 1 1 1 3 1 3 1 2 2 1 1 1 2 1 2 1 1 1 1 2 1 2 1 2 1 1 1 1 2 1 2 1 1 1 1 2 1 2 1 1 1 1 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 11 11 11 11 11 i = 14 tt = 7 7 7 7 7 7 6 5 5 4 3 3 2 1 1 1 11 10 9 8 7 6 3 5 5 2 4 4 1 ...

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

i = 1 tt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 stri = 1 i = 2 tt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 stri = 1 1 i = 3 tt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 stri = 1 1 1 i = 4 tt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 stri = 1 1 1 1 i = 5 tt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 stri = 1 1 1 1 17 i = 6 tt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 stri = 1 1 1 1 17 17 i = 7 tt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1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1 stri = 1 1 1 1 17 17 17 17 17 17 17 17 i = 13 tt = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1 1 1 1 1 1 1 1 1 ...

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

i = 1 tt = 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 stri = 5 i = 2 tt = 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 3 2 3 2 3 3 3 3 3 3 3 3 3 3 2 2 1 1 stri = 5 5 i = 3 tt = 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 3 2 3 2 3 3 3 3 3 3 3 3 3 3 2 2 1 1 2 2 2 2 1 1 2 2 1 2 2 1 2 2 2 1 1 1 stri = 5 5 5 i = 4 tt = 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 3 2 3 2 3 3 3 3 3 3 3 3 3 3 2 2 1 1 2 2 2 2 1 1 2 2 1 2 2 1 2 2 2 1 1 1 2 1 1 1 2 2 1 2 1 2 1 2 1 2 1 1 1 1 stri = 5 5 5 5 i = 5 tt = 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 3 2 3 2 3 3 3 3 3 3 3 3 3 3 2 2 1 1 2 2 2 2 1 1 2 2 1 2 2 1 2 2 2 1 1 1 2 1 1 1 2 2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 1 1 1 1 1 1 1 1 stri = 5 5 5 5 5 5 5 5 5 8 8 i = 12 tt = 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 3 2 3 2 3 3 3 3 3 3 3 3 3 3 2 2 1 1 2 2 2 2 1 1 2 2 1 2 2 1 2 2 2 1 1 1 2 1 1 1 2 2 1 2 1 2 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 1 1 1 1 8 7 6 5 4 3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 stri = 5 5 5 5 5 5 5 5 5 8 8 8 i = 13 tt = 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 3 2 1 3 2 3 2 3 3 3 3 3 3 3 3 3 3 2 2 1 1 2 2 2 2 1 1 2 2 1 2 2 1 2 2 2 1 1 1 2 1 1 1 2 2 1 2 1 2 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

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

i = 1 tt = Columns 1 through 30 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 Columns 31 through 60 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 Columns 61 through 80 3 3 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 stri = 3 i = 2 tt = Columns 1 through 30 3 3 3 3 3 3 3 3 3 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