Cody

Solution 1983603

Submitted on 20 Oct 2019 at 16:57
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
x = [11; 4; 16; 3; 3; 15; 6; 17; 10; 18; 7; 13; 15; 5; 24; 5; 3; 3]; NextNumber= 3; assert(isequal(FindNextNumber(x),NextNumber))

ans = 16

Output argument "NextNumber" (and maybe others) not assigned during call to "FindNextNumber". Error in Test1 (line 20) assert(isequal(FindNextNumber(x),NextNumber))

2   Fail
x = [9; 1; 7; 1; 7; 9; 2; 8; 4; 8; 16; 21; 13; 15; 1; 13; 10]; NextNumber= 8; assert(isequal(FindNextNumber(x),NextNumber))

ans = 8 8

Output argument "NextNumber" (and maybe others) not assigned during call to "FindNextNumber". Error in Test2 (line 19) assert(isequal(FindNextNumber(x),NextNumber))

3   Fail
x = [6; 20; 9; 3; 25; 4; 1; 4; 8; 9; 1; 7]; NextNumber= 1; assert(isequal(FindNextNumber(x),NextNumber))

ans = 1 1

Output argument "NextNumber" (and maybe others) not assigned during call to "FindNextNumber". Error in Test3 (line 14) assert(isequal(FindNextNumber(x),NextNumber))

4   Fail
x = [17; 5; 12; 33; 5; 7; 4]; NextNumber= 4; assert(isequal(FindNextNumber(x),NextNumber))

ans = 33

Output argument "NextNumber" (and maybe others) not assigned during call to "FindNextNumber". Error in Test4 (line 9) assert(isequal(FindNextNumber(x),NextNumber))

5   Fail
x = [8; 6; 11; 4; 1; 6; 2; 1; 3; 11; 4; 16; 3; 3; 15; 6; 17; 10; 18; 7; 13; 15; 5; 24; 5; 3; 3; 1; 2; 5; 16; 1; 2; 17; 9; 8; 5; 12; 16; 11; 8; 5; 10; 11; 10; 10; 2; 4; 17; 5; 12; 33; 5; 7; 4; 11; 16; 5; 1; 6; 20; 9; 3; 25; 4; 1]; NextNumber= 5; assert(isequal(FindNextNumber(x),NextNumber))

ans = 8 8 8

Output argument "NextNumber" (and maybe others) not assigned during call to "FindNextNumber". Error in Test5 (line 68) assert(isequal(FindNextNumber(x),NextNumber))

6   Fail
x = [4; 4; 18; 12; 27; 20; 24; 25; 14; 29; 16; 25; 15; 6; 6; 3; 20; 9; 20; 5; 12; 24; 16; 27]; NextNumber= 20; assert(isequal(FindNextNumber(x),NextNumber))

Index exceeds the number of array elements (24). Error in FindNextNumber (line 2) x(find(x==x(x(end)))) Error in Test6 (line 26) assert(isequal(FindNextNumber(x),NextNumber))

7   Fail
x = [14; 22; 27; 15; 8; 30; 24; 33; 28; 27; 31; 31; 38; 29; 30; 35; 12; 7; 15; 22; 10; 26; 35; 15; 25; 18; 32; 30; 31; 35; 22; 15; 21; 13; 19; 24; 32; 18; 30; 31; 28; 32; 40; 17; 15; 28; 41; 42; 35; 30; 35; 39; 33; 17; 34; 26; 13; 14; 19; 40; 13; 27; 16; 23; 22; 29; 42; 33; 37; 28; 36; 30; 26; 6; 25; 39; 26; 23; 39; 27; 28; 14; 25; 29; 7; 16]; NextNumber= 35; assert(isequal(FindNextNumber(x),NextNumber))

ans = 35 35 35 35 35

Output argument "NextNumber" (and maybe others) not assigned during call to "FindNextNumber". Error in Test7 (line 88) assert(isequal(FindNextNumber(x),NextNumber))

8   Fail
x = [27; 31; 31; 38; 29; 30; 35; 12; 7; 15; 22; 10; 26; 35; 15; 25; 18; 32; 30; 31; 35; 22; 15; 21; 13; 19; 24; 32; 18; 30; 31; 28; 32; 40; 17; 15; 28; 41; 42; 35; 30; 35; 39; 33; 17; 34; 26; 13; 14; 19; 40; 13; 27; 16; 23; 22; 29; 42; 33; 37; 28; 36; 30; 26; 6; 25; 39; 26; 23; 39; 27; 28; 14; 25; 29; 7; 16; 28; 11; 14]; NextNumber= 28; assert(isequal(FindNextNumber(x),NextNumber))

ans = 35 35 35 35 35

Output argument "NextNumber" (and maybe others) not assigned during call to "FindNextNumber". Error in Test8 (line 82) assert(isequal(FindNextNumber(x),NextNumber))

9   Fail
x = [39; 46; 39; 21; 46; 46; 45; 31; 47; 45; 39; 44; 47]; NextNumber= 45; assert(isequal(FindNextNumber(x),NextNumber))

Index exceeds the number of array elements (13). Error in FindNextNumber (line 2) x(find(x==x(x(end)))) Error in Test9 (line 15) assert(isequal(FindNextNumber(x),NextNumber))

10   Fail
x = [7; 8; 18; 7; 9; 2; 11; 2; 2; 2; 13; 4; 4; 13; 11; 6; 3; 15; 16; 17; 4; 7; 17; 12; 3; 12; 9; 3; 17; 2; 4; 17; 5; 18; 1; 4; 15; 2; 11; 6; 19; 4; 2; 1; 18; 15; 12; 17; 11; 2; 1; 3; 17; 15; 4; 12; 10; 11; 16; 4; 2; 13; 13; 8; 16; 2; 9; 19; 7; 15; 12; 5; 17; 6; 9; 16; 9; 11; 4; 12; 7; 12; 9; 18; 2; 8; 14]; NextNumber= 4; assert(isequal(FindNextNumber(x),NextNumber))

ans = 13 13 13 13

Output argument "NextNumber" (and maybe others) not assigned during call to "FindNextNumber". Error in Test10 (line 89) assert(isequal(FindNextNumber(x),NextNumber))