Cody

# Problem 95. Given two strings, find the maximum overlap

Solution 1879924

Submitted on 20 Jul 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   Fail
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))

ans = 5 14 26 40 54 38 23 10

Output argument "s3" (and maybe others) not assigned during call to "overlap". Error in Test1 (line 4) assert(isequal(overlap(s1,s2),s3_correct))

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

ans = 1 0 2 7 9 14 14 14 13 7 6

Output argument "s3" (and maybe others) not assigned during call to "overlap". Error in Test2 (line 4) assert(isequal(overlap(s1,s2),s3_correct))

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

ans = 27 15 56 38 76 117 71 137 114 83 111 53 45 25

Output argument "s3" (and maybe others) not assigned during call to "overlap". Error in Test3 (line 4) assert(isequal(overlap(s1,s2),s3_correct))

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

ans = Columns 1 through 15 50 151 252 353 454 555 656 757 858 959 1060 1161 1262 1363 1464 Columns 16 through 30 1565 1666 1767 1868 1969 2070 2171 2272 2373 2474 2575 2676 2777 2878 2979 Columns 31 through 45 3080 3181 3282 3383 3484 3585 3686 3787 3888 3989 4090 4191 4292 4393 4494 Columns 46 through 60 4595 4696 4797 4898 4999 5100 5201 5302 5403 5504 5605 5706 5807 5908 6009 Columns 61 through 75 6110 6211 6312 6413 6514 6615 6716 6817 6918 7019 7120 7221 7322 7423 7524 Columns 76 through 90 7625 7726 7827 7928 8029 8130 8231 8332 8433 8534 8635 8736 8837 8938 9039 Columns 91 through 101 9140 9241 9342 9443 9544 9645 9746 9847 9948 10049 5100

Output argument "s3" (and maybe others) not assigned during call to "overlap". Error in Test4 (line 4) assert(isequal(overlap(s1,s2),s3_correct))

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

ans = Columns 1 through 15 900 2800 5800 10000 15500 22400 30800 40800 52500 66000 81400 98800 104500 108000 109200 Columns 16 through 23 108000 104300 98000 89000 77200 62500 44800 24000

Output argument "s3" (and maybe others) not assigned during call to "overlap". Error in Test5 (line 4) assert(isequal(overlap(s1,s2),s3_correct))