Cody

Solution 1900151

Submitted on 14 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))

1 2 3 4 5 7 9 11 8 1 2 2 2 2 2 2 2 2 2

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

1 2 6 11 11 16 20 23 26 29 29 32 35 38 38 41 47 56 65 74 83 92 22 1 1 3 3 3 3 3 3 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9

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

2 4 6 8 10 12 13 14 14 15 16 16 17 18 20 22 16 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

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

37 42 47 52 57 62 67 72 77 82 87 92 97 102 107 112 117 17 1 2 3 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 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))

1 2 3 4 5 101 111 121 131 141 151 161 171 201 202 203 204 205 18 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Assertion failed.

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

Columns 1 through 30 2 3 5 7 7 11 13 17 19 23 24 29 31 37 41 41 43 47 53 58 59 61 67 71 73 75 79 83 89 92 Columns 31 through 60 97 101 103 107 109 109 113 126 127 131 137 139 143 149 151 157 160 163 167 173 177 179 181 191 193 194 197 199 211 211 Columns 61 through 80 223 227 228 229 233 239 241 245 251 257 262 263 269 271 277 279 281 283 293 296 80 1 2 2 4 4 6 6 6 6 6 6 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30

Assertion failed.