Cody

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

Solution 1940368

Submitted on 17 Sep 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))

r = 0.0000 2.0000 7.0000 16.0000 30.0000 44.0000 46.0000 40.0000 25.0000 lags = -4 -3 -2 -1 0 1 2 3 4 s3 = 0

Assertion failed.

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

r = 0 0.0000 1.0000 0.0000 2.0000 7.0000 9.0000 14.0000 14.0000 14.0000 13.0000 7.0000 6.0000 lags = -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 s3 = 0

Assertion failed.

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

r = Columns 1 through 18 -0.0000 0.0000 -0.0000 0.0000 0.0000 0 0 15.0000 23.0000 32.0000 58.0000 48.0000 113.0000 83.0000 105.0000 146.0000 75.0000 107.0000 Columns 19 through 21 81.0000 37.0000 45.0000 lags = -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 s3 = 0

Assertion failed.

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

r = 1.0e+04 * Columns 1 through 18 0 0.0000 0 0.0000 -0.0000 0.0000 0 -0.0000 -0.0000 -0.0000 0 -0.0000 0 -0.0000 0.0000 -0.0000 -0.0000 -0.0000 Columns 19 through 36 -0.0000 0 -0.0000 0.0000 0.0000 -0.0000 0.0000 0 0 0.0000 0 -0.0000 0 -0.0000 0.0000 -0.0000 0.0000 -0.0000 Columns 37 through 54 -0.0000 -0.0000 0 0 -0.0000 0.0000 0.0000 -0.0000 0.0000 -0.0000 0 0 0.0000 -0.0000 -0.0000 0 0.0000 -0.0000 Columns 55 through 72 0.0000 -0.0000 0 0 0.0000 0 -0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000 -0.0000 -0.0000 0.0000 -0.0000 -0.0000 -0.0000 Columns 73 through 90 -0.0000 -0.0000 -0.0000 0 -0.0000 0 0 -0.0000 -0.0000 0 0 -0.0000 0 -0.0000 0.0000 0 0 -0.0000 Columns 91 through 108 -0.0000 -0.0000 0 -0.0000 -0.0000 0.0000 -0.0000 0.0000 0.0051 0.0152 0.0253 0.0354 0.0455 0.0556 0.0657 0.0758 0.0859 0.0960 Columns 109 through 126 0.1061 0.1162 0.1263 0.1364 0.1465 0.1566 0.1667 0.1768 0.1869 0.1970 0.2071 0.2172 0.2273 0.2374 0.2475 0.2576 0.2677 0.2778 Columns 127 through 144 0.2879 0.2980 0.3081 0.3182 0.3283 0.3384 0.3485 0.3586 0.3687 0.3788 0.3889 0.3990 0.4091 0.4192 0.4293 0.4394 0.4495 0.4596 Columns 145 through 162 0.4697 0.4798 0.4899 0.5000 0.5101 0.5202 0.5303 0.5404 0.5505 0.5606 0.5707 0.5808 0.5909 0.6010 0.6111 0.6212 0.6313 0.6414 Columns 163 through 180 0.6515 0.6616 0.6717 0.6818 0.6919 0.7020 0.7121 0.7222 0.7323 0.7424 0.7525 0.7626 0.7727 0.7828 0.7929 0.8030 0.8131 0.8232 Columns 181 through 198 0.8333 0.8434 0.8535 0.8636 0.8737 0.8838 0.8939 0.9040 0.9141 0.9242 0.9343 0.9444 0.9545 0.9646 0.9747 0.9848 0.9949 1.0050 Column 199 0.5000 lags = Columns 1 through 30 -99 -98 -97 -96 -95 -94 -93 -92 -91 -90 -89 -88 -87 -86 -85 -84 -83 -82 -81 -80 -79 -78 -77 -76 -75 -74 -73 -72 -71 -70 Columns 31 through 60 -69 -68 -67 -66 -65 -64 -63 -62 -61 -60 -59 -58 -57 -56 -55 -54 -53 -52 -51 -50 -49 -48 -47 -46 -45 -44 -43 -42 -41 -40 Columns 61 through 90 -39 -38 -37 -36 -35 -34 -33 -32 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -21 -20 -19 -18 -17 -16 -15 -14 -13 -12 -11 -10 Columns 91 through 120 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Columns 121 through 150 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 Columns 151 through 180 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 Columns 181 through 199 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 s3 = 0

Assertion failed.

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

r = 1.0e+05 * Columns 1 through 18 0.1080 0.2190 0.3320 0.4460 0.5600 0.6730 0.7840 0.8920 0.9960 1.0950 1.1880 1.2740 1.1000 0.9350 0.7800 0.6360 0.5040 0.3850 Columns 19 through 23 0.2800 0.1900 0.1160 0.0590 0.0200 lags = -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 s3 = 0

Assertion failed.