Cody

Solution 2494793

Submitted on 8 Jun 2020
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
nterms = 10; term0 = randi(10); increment = (-1)^randi(2)*randi(10); correctsequence = term0:increment:term0+(nterms-1)*increment; for position = 1:nterms errorsequence = correctsequence; errorsequence(position) = errorsequence(position) + (-1)^randi(2)*randi(50); [errorposition, truesequence] = find_error(errorsequence); assert(errorposition == position && isequal(truesequence, correctsequence), 'failed test 1 at position %d', position); end

errorsequence = -15 7 12 17 22 27 32 37 42 47

failed test 1 at position 1

2   Fail
nterms = 201; term0 = randi(10); increment = (-1)^randi(2)*randi(10); correctsequence = term0:increment:term0+(nterms-1)*increment; for position = 1:10:nterms errorsequence = correctsequence; errorsequence(position) = errorsequence(position) + (-1)^randi(2)*randi(50); [errorposition, truesequence] = find_error(errorsequence); assert(errorposition == position && isequal(truesequence, correctsequence), 'failed test 2 at position %d', position); end

errorsequence = Columns 1 through 15 -5 15 22 29 36 43 50 57 64 71 78 85 92 99 106 Columns 16 through 30 113 120 127 134 141 148 155 162 169 176 183 190 197 204 211 Columns 31 through 45 218 225 232 239 246 253 260 267 274 281 288 295 302 309 316 Columns 46 through 60 323 330 337 344 351 358 365 372 379 386 393 400 407 414 421 Columns 61 through 75 428 435 442 449 456 463 470 477 484 491 498 505 512 519 526 Columns 76 through 90 533 540 547 554 561 568 575 582 589 596 603 610 617 624 631 Columns 91 through 105 638 645 652 659 666 673 680 687 694 701 708 715 722 729 736 Columns 106 through 120 743 750 757 764 771 778 785 792 799 806 813 820 827 834 841 Columns 121 through 135 848 855 862 869 876 883 890 897 904 911 918 925 932 939 946 Columns 136 through 150 953 960 967 974 981 988 995 1002 1009 1016 1023 1030 1037 1044 1051 Columns 151 through 165 1058 1065 1072 1079 1086 1093 1100 1107 1114 1121 1128 1135 1142 1149 1156 Columns 166 through 180 1163 1170 1177 1184 1191 1198 1205 1212 1219 1226 1233 1240 1247 1254 1261 Columns 181 through 195 1268 1275 1282 1289 1296 1303 1310 1317 1324 1331 1338 1345 1352 1359 1366 Columns 196 through 201 1373 1380 1387 1394 1401 1408

failed test 2 at position 1