Cody

Solution 1945333

Submitted on 22 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
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

seq = 34 13 22 31 40 49 58 67 76 85 correz = 30 seq = 4 13 22 31 40 49 58 67 76 85 seq = 4 38 22 31 40 49 58 67 76 85 correz = 25 seq = 4 13 22 31 40 49 58 67 76 85 seq = 4 13 -10 31 40 49 58 67 76 85 correz = -32 seq = 4 13 22 31 40 49 58 67 76 85 seq = 4 13 22 -12 40 49 58 67 76 85 correz = -43 seq = 4 13 22 31 40 49 58 67 76 85 seq = 4 13 22 31 77 49 58 67 76 85 correz = 37 seq = 4 13 22 31 40 49 58 67 76 85 seq = 4 13 22 31 40 86 58 67 76 85 correz = 37 seq = 4 13 22 31 40 49 58 67 76 85 seq = 4 13 22 31 40 49 10 67 76 85 correz = -48 seq = 4 13 22 31 40 49 58 67 76 85 seq = 4 13 22 31 40 49 58 52 76 85 correz = -15 seq = 4 13 22 31 40 49 58 67 76 85 seq = 4 13 22 31 40 49 58 67 81 85 correz = 5 seq = 4 13 22 31 40 49 58 67 76 85 seq = 4 13 22 31 40 49 58 67 76 59 correz = 26 seq = 4 13 22 31 40 49 58 67 76 33

failed test 1 at position 10

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

seq = Columns 1 through 30 19 3 -2 -7 -12 -17 -22 -27 -32 -37 -42 -47 -52 -57 -62 -67 -72 -77 -82 -87 -92 -97 -102 -107 -112 -117 -122 -127 -132 -137 Columns 31 through 60 -142 -147 -152 -157 -162 -167 -172 -177 -182 -187 -192 -197 -202 -207 -212 -217 -222 -227 -232 -237 -242 -247 -252 -257 -262 -267 -272 -277 -282 -287 Columns 61 through 90 -292 -297 -302 -307 -312 -317 -322 -327 -332 -337 -342 -347 -352 -357 -362 -367 -372 -377 -382 -387 -392 -397 -402 -407 -412 -417 -422 -427 -432 -437 Columns 91 through 120 -442 -447 -452 -457 -462 -467 -472 -477 -482 -487 -492 -497 -502 -507 -512 -517 -522 -527 -532 -537 -542 -547 -552 -557 -562 -567 -572 -577 -582 -587 Columns 121 through 150 -592 -597 -602 -607 -612 -617 -622 -627 -632 -637 -642 -647 -652 -657 -662 -667 -672 -677 -682 -687 -692 -697 -702 -707 -712 -717 -722 -727 -732 -737 Columns 151 through 180 -742 -747 -752 -757 -762 -767 -772 -777 -782 -787 -792 -797 -802 -807 -812 -817 -822 -827 -832 -837 -842 -847 -852 -857 -862 -867 -872 -877 -882 -887 Columns 181 through 201 -892 -897 -902 -907 -912 -917 -922 -927 -932 -937 -942 -947 -952 -957 -962 -967 -972 -977 -982 -987 -992 correz = 11 seq = Columns 1 through 30 8 3 -2 -7 -12 -17 -22 -27 -32 -37 -42 -47 -52 -57 -62 -67 -72 -77 -82 -87 -92 -97 -102 -107 -112 -117 -122 -127 -132 -137 Columns 31 through 60 -142 -147 -152 -157 -162 -167 -172 -177 -182 -187 -192 -197 -202 -207 -212 -217 -222 -227 -232 -237 -242 -247 -252 -257 -262 -267 -272 -277 -282 -287 Columns 61 through 90 -292 -297 -302 -307 -312 -317 -322 -327 -332 -337 -342 -347 -352 -357 -362 -367 -372 -377 -382 -387 -392 -397 -402 -407 -412 -417 -422 -427 -432 -437 Columns 91 through 120 -442 -447 -452 -457 -462 -467 -472 -477 -482 -487 -492 -497 -502 -507 -512 -517 -522 -527 -532 -537 -542 -547 -552 -557 -562 -567 -572 -577 -582 -587 Columns 121 through 150 -592 -597 -602 -607 -612 -617 -622 -627 -632 -637 -642 -647 -652 -657 -662 -667 -672 -677 -682 -687 -692 -697 -702 -707 -712 -717 -722 -727 -732 -737 Columns 151 through 180 -742 -747 -752 -757 -762 -767 -772 -777 -782 -787 -792 -797 -802 -807 -812 -817 -822 -827 -832 -837 -842 -847 -852 -857 -862 -867 -872 -877 -882 -887 Columns 181 through 201 -892 -897 -902 -907 -912 -917 -922 -927 -932 -937 -942 -947 -952 -957 -962 -967 -972 -977 -982 -987 -992 seq = Columns 1 through 30 8 3 -2 -7 -12 -17 -22 -27 -32 -37 -67 -47 -52 -57 -62 -67 -72 -77 -82 -87 -92 -97 -102 -107 -112 -117 -122 -127 -132 -137 Columns 31 through 60 -142 -147 -152 -157 -162 -167 -172 -177 -182 -187 -192 -197 -202 -207 -212 -217 -222 -227 -232 -237 -242 -247 -252 -257 -262 -267 -272 -277 -282 -287 Columns 61 through 90 -292 -297 -302 -307 -312 -317 -322 -327 -332 -337 -342 -347 -352 -357 -362 -367 -372 -377 -382 -387 -392 -397 -402 -407 -412 -417 -422 -427 -432 -437 Columns 91 through 120 -442 -447 -452 -457 -462 -467 -472 -477 -482 -487 -492 -497 -502 -507 -512 -517 -522 -527 -532 -537 -542 -547 -552 -557 -562 -567 -572 -577 -582 -587 Columns 121 through 150 -592 -597 -602 -607 -612 -617 -622 -627 -632 -637 -642 -647 -652 -657 -662 -667 -672 -677 -682 -687 -692 -697 -702 -707 -712 -717 -722 -727 -732 -737 Columns 151 through 180 -742 -747 -752 -757 -762 -767 -772 -777 -782 -787 -792 -797 -802 -807 -812 -817 -822 -827 -832 -837 -842 -847 -852 -857 -862 -867 -872 -877 -882 -887 Columns 181 through 201 -892 -897 -902 -907 -912 -917 -922 -927 -932 -937 -942 -947 -952 -957 -962 -967 -972 -977 -982 -987 -992 correz = -25 seq = Columns 1 through 30 8 3 -2 -7 -12 -17 -22 -27 -32 -37 -42 -47 -52 -57 -62 -67 -72 -77 -82 -87 -92 -97 -102 -107 -112 -117 -122 -127 -132 -137 Columns 31 through 60 -142 -147 -152 -157 -162 -167 -172 -177 -182 -187 -192 -197 -202 -207 -212 -217 -222 -227 -232 -237 -242 -247 -252 -257 -262 -267 -272 -277 -282 -287 Columns 61 through 90 -292 -297 -302 -307 -312 -317 -322 -327 -332 -337 -342 -347 -352 -357 -362 -367 -372 -377 -382 -387 -392 -397 -402 -407 -412 -417 -422 -427 -432 -437 Columns 91 through 120 -442 -447 -452 -457 -462 -467 -472 -477 -482 -487 -492 -497 -502 -507 -512 -517 -522 -527 -532 -537 -542 -547 -552 -557 -562 -567 -572 -577 -582 -587 Columns 121 through 150 -592 -597 -602 -607 -612 -617 -622 -627 -632 -637 -642 -647 -652 -657 -662 -667 -672 -677 -682 -687 -692 -697 -702 -707 -712 -717 -722 -727 -732 -737 Columns 151 through 180 -742 -747 -752 -757 -762 -767 -772 -777 -782 -787 -792 -797 -802 -807 -812 -817 -822 -827 -832 -837 -842 -847 -852 -857 -862 -867 -872 -877 -882 -887 Columns 181 through 201 -892 -897 -902 -907 -912 -917 -922 -927 -932 -937 -942 -947 -952 -957 -962 -967 -972 -977 -982 -987 -992 seq = Columns 1 through 30 8 3 -2 -7 -12 -17 -22 -27 -32 -37 -42 -47 -52 -57 -62 -67 -72 -77 -82 -87 -50 -97 -102 -107 -112 -117 -122 -127 -132 -137 Columns 31 through 60 -142 -147 -152 -157 -162 -167 -172 -177 -182 -187 -192 -197 -202 -207 -212 -217 -222 -227 -232 -237 -242 -247 -252 -257 -262 -267 -272 -277 -282 -287 Columns 61 through 90 -292 -297 -302 -307 -312 -317 -322 -327 -332 -337 -342 -347 -352 -357 -362 -367 -372 -377 -382 -387 -392 -397 -402 -407 -412 -417 -422 -427 -432 -437 Columns 91 through 120 -442 -447 -452 -457 -462 -467 -472 -477 -482 -487 -492 -497 -502 -507 -512 -517 -522 -527 -532 -537 -542 -547 -552 -557 -562 -567 -572 -577 -582 -587 Columns 121 through 150 -592 -597 -602 -607 -612 -617 -622 -627 -632 -637 -642 -647 -652 -657 -662 -667 -672 -677 -682 -687 -692 -697 -702 -707 -712 -717 -722 -727 -732 -737 Columns 151 through 180 -742 -747 -752 -757 -762 -767 -772 -777 -782 -787 -792 -797 -802 -807 -812 -817 -822 -827 -832 -837 -842 -847 -852 -857 -862 -867 -872 -877 -882 -887 Columns 181 through 201 -892 -897 -902 -907 -912 -917 -922 -927 -932 -937 -942 -947 -952 -957 -962 -967 -972 -977 -982 -987 -992 correz = 42 seq = Columns 1 through 30 8 3 -2 -7 -12 -17 -22 -27 -32 -37 -42 -47 -52 -57 -62 -67 -72 -77 -82 -87 -92 -97 -102 -107 -112 -117 -122 -127 -132 -137 Columns 31 through 60 -142 -147 -152 -157 -162 -167 -172 -177 -182 -187 -192 -197 -202 -207 -212 -217 -222 -227 -232 -237 -242 -247 -252 -257 -262 -267 -272 -277 -282 -287 Columns 61 through 90 -292 -297 -302 -307 -312 -317 -322 -327 -332 -337 -342 -347 -352 -357 -362 -367 -372 -377 -382 -387 -392 -397 -402 -407 -412 -417 -422 -427 -432 -437 Columns 91 through 120 -442 -447 -452 -457 -462 -467 -472 -477 -482 -487 -492 -497 -502 -507 -512 -517 -522 -527 -532 -537 -542 -547 -552 -557 -562 -567 -572 -577 -582 -587 Columns 121 through 150 -592 -597 -602 -607 -612 -617 -622 -627 -632 -637 -642 -647 -652 -657 -662 -667 -672 -677 -682 -687 -692 -697 -702 -707 -712 -717 -722 -727 -732 -737 Columns 151 through 180 -742 -747 -752 -757 -762 -767 -772 -777 -782 -787 -792 -797 -802 -807 -812 -817 -822 -827 -832 -837 -842 -847 -852 -857 -862 -867 -872 -877 -882 -887 Columns 181 through 201 -892 -897 -902 -907 -912 -917 -922 -927 -932 -937 -942 -947 -952 -957 -962 -967 -972 -977 -982 -987 -992 seq = Columns 1 through 30 8 3 -2 -7 -12 -17 -22 -27 -32 -37 -42 -47 -52 -57 -62 -67 -72 -77 -82 -87 -92 -97 -102 -107 -112 -117 -122 -127 -132 -137 Columns 31 through 60 -151 -147 -152 -157 -162 -167 -172 -177 -182 -187 -192 -197 -202 -207 -212 -217 -222 -227 -232 -237 -242 -247 -252 -257 -262 -267 -272 -277 -282 -287 Columns 61 through 90 -292 -297 -302 -307 -312 -317 -322 -327 -332 -337 -342 -347 -352 -357 -362 -367 -372 -377 -382 -387 -392 -397 -402 -407 -412 -417 -422 -427 -432 -437 Columns 91 through 120 -442 -447 -452 -457 -462 -467 -472 -477 -482 -487 -492 -497 -502 -507 -512 -517 -522 -527 -532 -537 -542 -547 -552 -557 -562 -567 -572 -577 -582 -587 Columns 121 through 150 -592 -597 -602 -607 -612 -617 -622 -627 -632 -637 -642 -647 -652 -657 -662 -667 -672 -677 -682 -687 -692 -697 -702 -707 -712 -717 -722 -727 -732 -737 Columns 151 through 180 -742 -747 -752 -757 -762 -767 -772 -777 -782 -787 -792 -797 -802 -807 -812 -817 -822 -827 -832 -837 -842 -847 -852 -857 -862 -867 -872 -877 -882 -887 Columns 181 through 201 -892 -897 -902 -907 -912 -917 -922 -927 -932 -937 -942 -947 -952 -957 -962 -967 -972 -977 -982 -987 -992 correz = -9 seq = Columns 1 through 30 8 3 -2 -7 -12...

failed test 2 at position 201

Suggested Problems

More from this Author9