Cody

Problem 1125. Find out missing number from a vector of 9 elements

Solution 2219360

Submitted on 18 Apr 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
x = [1 2 3 4 5 6 7 8 9]; y_correct = 0; assert(isequal(your_fcn_name(x),y_correct))

y = 0 1 2 3 4 5 6 7 8 9 ans = 1×10 logical array 0 1 1 1 1 1 1 1 1 1

Array indices must be positive integers or logical values. Error in your_fcn_name (line 4) y=y(y(~ans)) Error in Test1 (line 3) assert(isequal(your_fcn_name(x),y_correct))

2   Fail
x = [6 0 2 3 4 5 7 8 9]; y_correct = 1; assert(isequal(your_fcn_name(x),y_correct))

y = 0 1 2 3 4 5 6 7 8 9 ans = 1×10 logical array 1 0 1 1 1 1 1 1 1 1 y = 0

Assertion failed.

3   Fail
x = [6 7 8 1 0 3 4 5 9]; y_correct = 2; assert(isequal(your_fcn_name(x),y_correct))

y = 0 1 2 3 4 5 6 7 8 9 ans = 1×10 logical array 1 1 0 1 1 1 1 1 1 1 y = 1

Assertion failed.

4   Fail
x = [7 8 1 5 6 9 2 0 4]; y_correct = 3; assert(isequal(your_fcn_name(x),y_correct))

y = 0 1 2 3 4 5 6 7 8 9 ans = 1×10 logical array 1 1 1 0 1 1 1 1 1 1 y = 2

Assertion failed.

5   Fail
x = [0 1 9 2 6 7 8 3 5]; y_correct = 4; assert(isequal(your_fcn_name(x),y_correct))

y = 0 1 2 3 4 5 6 7 8 9 ans = 1×10 logical array 1 1 1 1 0 1 1 1 1 1 y = 3

Assertion failed.

6   Fail
x = [6 7 1 2 8 9 3 0 4]; y_correct = 5; assert(isequal(your_fcn_name(x),y_correct))

y = 0 1 2 3 4 5 6 7 8 9 ans = 1×10 logical array 1 1 1 1 1 0 1 1 1 1 y = 4

Assertion failed.

7   Fail
x = [9 8 7 5 4 3 2 1 0]; y_correct = 6; assert(isequal(your_fcn_name(x),y_correct))

y = 0 1 2 3 4 5 6 7 8 9 ans = 1×10 logical array 1 1 1 1 1 1 0 1 1 1 y = 5

Assertion failed.

8   Fail
x = [2 1 3 0 8 4 9 5 6]; y_correct = 7; assert(isequal(your_fcn_name(x),y_correct))

y = 0 1 2 3 4 5 6 7 8 9 ans = 1×10 logical array 1 1 1 1 1 1 1 0 1 1 y = 6

Assertion failed.

9   Fail
x = [9 1 5 6 7 0 3 2 4]; y_correct = 8; assert(isequal(your_fcn_name(x),y_correct))

y = 0 1 2 3 4 5 6 7 8 9 ans = 1×10 logical array 1 1 1 1 1 1 1 1 0 1 y = 7

Assertion failed.

10   Fail
x = [ 3 5 7 8 0 4 6 1 2]; y_correct = 9; assert(isequal(your_fcn_name(x),y_correct))

y = 0 1 2 3 4 5 6 7 8 9 ans = 1×10 logical array 1 1 1 1 1 1 1 1 1 0 y = 8

Assertion failed.