Cody

Problem 95. Given two strings, find the maximum overlap

Solution 2705235

Submitted on 17 Jul 2020 by Jacynth Tate Agraan
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))

i = 1 i = 2 i = 3 i = 4 i = 5 i = 6 i = 7 i = 8

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

i = 1 i = 2 i = 3 i = 4 i = 5 i = 6 i = 7 i = 8 i = 9 i = 10 i = 11

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

i = 1 i = 2 i = 3 i = 4 i = 5 i = 6 i = 7 i = 8 i = 9 i = 10 i = 11 i = 12 i = 13 i = 14

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

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

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

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

Suggested Problems

More from this Author95