Cody

Solution 1852417

Submitted on 18 Jun 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 = 'Alabama Montana Nebraska Vermont Nevada'; s2 = ' Vermont '; assert(isequal(s2, refcn(s1)))

n = 1 ends = 7 15 24 begs = 8 16 25 33 awords = 3 new = ' Montana Nebraska Vermont Nevada' ends = 8 17 begs = 1 9 18 26 n = 2 start = 1 new = ' Nebraska Vermont Nevada' ends = 10 begs = 1 2 11 19 n = 3 start = 2 new = ' Vermont Nevada' ends = [] begs = 1 2 3 11 n = 4 new = ' Vermont '

Error using erase Too many input arguments. Error in refcn (line 28) s2 = erase(new,"West","North") Error in Test1 (line 3) assert(isequal(s2, refcn(s1)))

2   Fail
s1 = 'Alabama Alaska Arizona Arkansas California Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota'; s2 = ' Arkansas Colorado Connecticut Delaware Hawaii Idaho Illinois Kansas Kentucky Maine Maryland Massachusetts Michigan '; assert(isequal(s2, refcn(s1)))

n = 1 ends = 7 14 22 42 80 88 118 123 149 begs = 8 15 23 32 43 52 64 73 81 89 96 102 111 119 124 131 140 150 156 165 179 188 awords = 9 new = ' Alaska Arizona Arkansas California Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota' ends = 7 15 35 73 81 111 116 142 begs = 1 8 16 25 36 45 57 66 74 82 89 95 104 112 117 124 133 143 149 158 172 181 n = 2 start = 1 new = ' Arizona Arkansas California Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota' ends = 9 29 67 75 105 110 136 begs = 1 2 10 19 30 39 51 60 68 76 83 89 98 106 111 118 127 137 143 152 166 175 n = 3 start = 2 new = ' Arkansas California Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota' ends = 22 60 68 98 103 129 begs = 1 2 3 12 23 32 44 53 61 69 76 82 91 99 104 111 120 130 136 145 159 168 n = 4 start = 4 new = ' Arkansas Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota' ends = 50 58 88 93 119 begs = 1 2 3 12 13 22 34 43 51 59 66 72 81 89 94 101 110 120 126 135 149 158 n = 5 start = 8 new = ' Arkansas Colorado Connecticut Delaware Georgia Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota' ends = 51 81 86 112 begs = 1 2 3 12 13 22 34 43 44 52 59 65 74 82 87 94 103 113 119 128 142 151 n = 6 start = 9 new = ' Arkansas Colorado Connecticut Delaware Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota' ends = 74 79 105 begs = 1 2 3 12 13 22 34 43 44 45 52 58 67 75 80 87 96 106 112 121 135 144 n = 7 start = 13 new = ' Arkansas Colorado Connecticut Delaware Hawaii Idaho Illinois Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota' ends = 72 98 begs = 1 2 3 12 13 22 34 43 44 45 52 58 67 68 73 80 89 99 105 114 128 137 n = 8 start = 14 new = ' Arkansas Colorado Connecticut Delaware Hawaii Idaho Illinois Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota' ends = 94 begs = 1 2 3 12 13 22 34 43 44 45 52 58 67 68 69 76 85 95 101 110 124 133 n = 9 start = 17 new = ' Arkansas Colorado Connecticut Delaware Hawaii Idaho Illinois Kansas Kentucky Maine Maryland Massachusetts Michigan Minnesota' ends = [] begs = 1 2 3 12 13 22 34 43 44 45 52 58 67 68 69 76 85 86 92 101 115 124 n = 10 new = ' Arkansas Colorado Connecticut Delaware Hawaii Idaho Illinois Kansas Kentucky Maine Maryland Massachusetts Michigan '

Error using erase Too many input arguments. Error in refcn (line 28) s2 = erase(new,"West","North") Error in Test2 (line 5) assert(isequal(s2, refcn(s1)))

3   Fail
s1 = 'New York North Carolina Michigan Arkansas Alabama North Dakota Hawaii West Virginia New Jersey'; s2 = 'New York Michigan Arkansas Hawaii New Jersey'; assert(isequal(s2, refcn(s1)))

n = 1 ends = 23 49 62 83 begs = 4 9 15 24 33 42 50 56 63 70 75 84 88 awords = 4 new = 'New York North Carolina Michigan Arkansas Alabama North Dakota Hawaii West Virginia New Jersey' start = 3 new = 'New York North Michigan Arkansas Alabama North Dakota Hawaii West Virginia New Jersey' ends = 41 54 75 begs = 4 9 15 16 25 34 42 48 55 62 67 76 80 n = 2 start = 6 new = 'New York North Michigan Arkansas North Dakota Hawaii West Virginia New Jersey' ends = 47 68 begs = 4 9 15 16 25 34 35 41 48 55 60 69 73 n = 3 start = 8 new = 'New York North Michigan Arkansas North Hawaii West Virginia New Jersey' ends = 62 begs = 4 9 15 16 25 34 35 41 42 49 54 63 67 n = 4 start = 11 new = 'New York North Michigan Arkansas North Hawaii West New Jersey' ends = [] begs = 4 9 15 16 25 34 35 41 42 49 54 55 59 n = 5

Error using erase Too many input arguments. Error in refcn (line 28) s2 = erase(new,"West","North") Error in Test3 (line 5) assert(isequal(s2, refcn(s1)))