Cody

Solution 1969001

Submitted on 9 Oct 2019 by Charles Juenger
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
s1 = [1 2 3 4 5]; s2 = [5 4 3 2]; s3_correct = [1 2 3 4 5 4 3 2]; assert(isequal(overlap(s1,s2),s3_correct))

a = 1 b = 2 a = 1 2 b = 3 2 a = 1 2 3 b = 4 3 2 a = 1 2 3 4 b = 5 4 3 2 a = 2 3 4 5 b = 5 4 3 2 a = 3 4 5 b = 5 4 3 a = 4 5 b = 5 4 a = 5 b = 5 s3 = 1 2 3 4 5 4 3 2

2   Pass
s1 = [1 0 1 7 7 7 6]; s2 = [1 0 1 0 1]; s3_correct = [1 0 1 0 1 7 7 7 6]; assert(isequal(overlap(s1,s2),s3_correct))

a = 1 b = 1 s3 = 1 0 1 0 1 0 1 7 7 7 6 a = 1 0 b = 0 1 a = 1 0 1 b = 1 0 1 s3 = 1 0 1 0 1 7 7 7 6 a = 1 0 1 7 b = 0 1 0 1 a = 1 0 1 7 7 b = 1 0 1 0 1 a = 0 1 7 7 7 b = 1 0 1 0 1 a = 1 7 7 7 6 b = 1 0 1 0 1 a = 7 7 7 6 b = 1 0 1 0 a = 7 7 6 b = 1 0 1 a = 7 6 b = 1 0 a = 6 b = 1

3   Pass
s1 = [3 1 4 1 5 9 2 6 5 3 5]; s2 = [9 2 6 5]; s3_correct = [3 1 4 1 5 9 2 6 5 3 5]; assert(isequal(overlap(s1,s2),s3_correct))

a = 3 b = 5 a = 3 1 b = 6 5 a = 3 1 4 b = 2 6 5 a = 3 1 4 1 b = 9 2 6 5 a = 1 4 1 5 b = 9 2 6 5 a = 4 1 5 9 b = 9 2 6 5 a = 1 5 9 2 b = 9 2 6 5 a = 5 9 2 6 b = 9 2 6 5 a = 9 2 6 5 b = 9 2 6 5 s3 = 3 1 4 1 5 9 2 6 5 3 5 a = 2 6 5 3 b = 9 2 6 5 a = 6 5 3 5 b = 9 2 6 5 a = 5 3 5 b = 9 2 6 a = 3 5 b = 9 2 a = 5 b = 9

4   Pass
s1 = 1:100; s2 = [50 51]; s3_correct = s1; assert(isequal(overlap(s1,s2),s3_correct))

a = 1 b = 51 a = 1 2 b = 50 51 a = 2 3 b = 50 51 a = 3 4 b = 50 51 a = 4 5 b = 50 51 a = 5 6 b = 50 51 a = 6 7 b = 50 51 a = 7 8 b = 50 51 a = 8 9 b = 50 51 a = 9 10 b = 50 51 a = 10 11 b = 50 51 a = 11 12 b = 50 51 a = 12 13 b = 50 51 a = 13 14 b = 50 51 a = 14 15 b = 50 51 a = 15 16 b = 50 51 a = 16 17 b = 50 51 a = 17 18 b = 50 51 a = 18 19 b = 50 51 a = 19 20 b = 50 51 a = 20 21 b = 50 51 a = 21 22 b = 50 51 a = 22 23 b = 50 51 a = 23 24 b = 50 51 a = 24 25 b = 50 51 a = 25 26 b = 50 51 a = 26 27 b = 50 51 a = 27 28 b = 50 51 a = 28 29 b = 50 51 a = 29 30 b = 50 51 a = 30 31 b = 50 51 a = 31 32 b = 50 51 a = 32 33 b = 50 51 a = 33 34 b = 50 51 a = 34 35 b = 50 51 a = 35 36 b = 50 51 a = 36 37 b = 50 51 a = 37 38 b = 50 51 a = 38 39 b = 50 51 a = 39 40 b = 50 51 a = 40 41 b = 50 51 a = 41 42 b = 50 51 a = 42 43 b = 50 51 a = 43 44 b = 50 51 a = 44 45 b = 50 51 a = 45 46 b = 50 51 a = 46 47 b = 50 51 a = 47 48 b = 50 51 a = 48 49 b = 50 51 a = 49 50 b = 50 51 a = 50 51 b = 50 51 s3 = Columns 1 through 30 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 26 27 28 29 30 Columns 31 through 60 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 Columns 61 through 90 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 Columns 91 through 100 91 92 93 94 95 96 97 98 99 100 a = 51 52 b = 50 51 a = 52 53 b = 50 51 a = 53 54 b = 50 51 a = 54 55 b = 50 51 a = 55 56 b = 50 51 a = 56 57 b = 50 51 a = 57 58 b = 50 51 a = 58 59 b = 50 51 a = 59 60 b = 50 51 a = 60 61 b = 50 51 a = 61 62 b = 50 51 a = 62 63 b = 50 51 a = 63 64 b = 50 51 a = 64 65 b = 50 51 a = 65 66 b = 50 51 a = 66 67 b = 50 51 a = 67 68 b = 50 51 a = 68 69 b = 50 51 a = 69 70 b = 50 51 a = 70 71 b = 50 51 a = 71 72 b = 50 51 a = 72 73 b = 50 51 a = 73 74 b = 50 51 a = 74 75 b = 50 51 a = 75 76 b = 50 51 a = 76 77 b = 50 51 a = 77 78 b = 50 51 a = 78 79 b = 50 51 a = 79 80 b = 50 51 a = 80 81 b = 50 51 a = 81 82 b = 50 51 a = 82 83 b = 50 51 a = 83 84 b = 50 51 a = 84 85 b = 50 51 a = 85 86 b = 50 51 a = 86 87 b = 50 51 a = 87 88 b = 50 51 a = 88 89 b = 50 51 a = 89 90 b = 50 51 a = 90 91 b = 50 51 a = 91 92 b = 50 51 a = 92 93 b = 50 51 a = 93 94 b = 50 51 a = 94 95 b = 50 51 a = 95 96 b = 50 51 a = 96 97 b = 50 51 a = 97 98 b = 50 51 a = 98 99 b = 50 51 a = 99 100 b = 50 51 a = 100 b = 50

5   Pass
s1 = 90:10:200; s2 = 10:10:120; s3_correct = 10:10:200; assert(isequal(overlap(s1,s2),s3_correct))

a = 90 b = 120 a = 90 100 b = 110 120 a = 90 100 110 b = 100 110 120 a = 90 100 110 120 b = 90 100 110 120 s3 = 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 a = 90 100 110 120 130 b = 80 90 100 110 120 a = 90 100 110 120 130 140 b = 70 80 90 100 110 120 a = 90 100 110 120 130 140 150 b = 60 70 80 90 100 110 120 a = 90 100 110 120 130 140 150 160 b = 50 60 70 80 90 100 110 120 a = 90 100 110 120 130 140 150 160 170 b = 40 50 60 70 80 90 100 110 120 a = 90 100 110 120 130 140 150 160 170 180 b = 30 40 50 60 70 80 90 100 110 120 a = 90 100 110 120 130 140 150 160 170 180 190 b = 20 30 40 50 60 70 80 90 100 110 120 a = 90 100 110 120 130 140 150 160 170 180 190 200 b = 10 20 30 40 50 60 70 80 90 100 110 120 a = 100 110 120 130 140 150 160 170 180 190 200 b = 10 20 30 40 50 60 70 80 90 100 110 a = 110 120 130 140 150 160 170 180 190 200 b = 10 20 30 40 50 60 70 80 90 100 a = 120 130 140 150 160 170 180 190 200 b = 10 20 30 40 50 60 70 80 90 a = 130 140 150 160 170 180 190 200 b = 10 20 30 40 50 60 70 80 a = 140 150 160 170 180 190 200 b = 10 20 30 40 50 60 70 a = 150 160 170 180 190 200 b = 10 20 30 40 50 60 a = 160 170 180 190 200 b = 10 20 30 40 50 a = 170 180 190 200 b = 10 20 30 40 a = 180 190 200 b = 10 20 30 a = 190 200 b = 10 20 a = 200 b = 10