Cody

Solution 1695869

Submitted on 19 Dec 2018
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) ratio = (-1)^randi(2)*randi(10) correctsequence = term0*ratio.^(0:nterms-1); 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

term0 = 7 ratio = 3 errorseq = 45 21 63 189 567 1701 5103 15309 45927 137781 most = 3 errpos = 1 trueseq = 7 21 63 189 567 1701 5103 15309 45927 137781 errorseq = 7 13 63 189 567 1701 5103 15309 45927 137781 most = 3 errpos = 2 trueseq = 7 21 63 189 567 1701 5103 15309 45927 137781 errorseq = 7 21 25 189 567 1701 5103 15309 45927 137781 most = 3 errpos = 3 trueseq = 7 21 63 189 567 1701 5103 15309 45927 137781 errorseq = 7 21 63 175 567 1701 5103 15309 45927 137781 most = 3 errpos = 4 trueseq = 7 21 63 189 567 1701 5103 15309 45927 137781 errorseq = 7 21 63 189 616 1701 5103 15309 45927 137781 most = 3 errpos = 5 trueseq = 7 21 63 189 567 1701 5103 15309 45927 137781 errorseq = 7 21 63 189 567 1711 5103 15309 45927 137781 most = 3 errpos = 6 trueseq = 7 21 63 189 567 1701 5103 15309 45927 137781 errorseq = 7 21 63 189 567 1701 5064 15309 45927 137781 most = 3 errpos = 7 trueseq = 7 21 63 189 567 1701 5103 15309 45927 137781 errorseq = 7 21 63 189 567 1701 5103 15349 45927 137781 most = 3 errpos = 8 trueseq = 7 21 63 189 567 1701 5103 15309 45927 137781 errorseq = 7 21 63 189 567 1701 5103 15309 45969 137781 most = 3 errpos = 9 trueseq = 7 21 63 189 567 1701 5103 15309 45927 137781 errorseq = 7 21 63 189 567 1701 5103 15309 45927 137825 most = 3 errpos = 9 trueseq = 1.0e+05 * 0.0001 0.0002 0.0006 0.0019 0.0057 0.0170 0.0510 0.1531 0.4594 1.3782

failed test 1 at position 10

2   Fail
nterms = 15; term0 = randi(10) ratio = (-1)^randi(2)*randi(10) correctsequence = term0*ratio.^(0:nterms-1); 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 2 at position %d', position); end

term0 = 8 ratio = -1 errorseq = -42 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 most = -1 errpos = 1 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 errorseq = 8 21 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 most = -1 errpos = 2 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 errorseq = 8 -8 3 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 most = -1 errpos = 3 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 errorseq = 8 -8 8 -11 8 -8 8 -8 8 -8 8 -8 8 -8 8 most = -1 errpos = 4 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 errorseq = 8 -8 8 -8 -1 -8 8 -8 8 -8 8 -8 8 -8 8 most = -1 errpos = 5 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 errorseq = 8 -8 8 -8 8 -46 8 -8 8 -8 8 -8 8 -8 8 most = -1 errpos = 6 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 errorseq = 8 -8 8 -8 8 -8 -31 -8 8 -8 8 -8 8 -8 8 most = -1 errpos = 7 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 errorseq = 8 -8 8 -8 8 -8 8 -1 8 -8 8 -8 8 -8 8 most = -1 errpos = 8 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 errorseq = 8 -8 8 -8 8 -8 8 -8 12 -8 8 -8 8 -8 8 most = -1 errpos = 9 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 errorseq = 8 -8 8 -8 8 -8 8 -8 8 -13 8 -8 8 -8 8 most = -1 errpos = 10 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 errorseq = 8 -8 8 -8 8 -8 8 -8 8 -8 -1 -8 8 -8 8 most = -1 errpos = 11 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 errorseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -3 8 -8 8 most = -1 errpos = 12 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 errorseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 40 -8 8 most = -1 errpos = 13 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 errorseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 3 8 most = -1 errpos = 14 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 errorseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 -17 most = -1 errpos = 14 trueseq = 8 -8 8 -8 8 -8 8 -8 8 -8 8 -8 8 17 -17

failed test 2 at position 15

Suggested Problems

More from this Author9