Cody

Problem 44549. Find the missing numbers.

Solution 2065265

Submitted on 20 Dec 2019 by Martin C.
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   Pass
N = 5; ipArray = [2 5 3 1]; y_correct = 4; assert(isequal(findMissingNumbers(N, ipArray),y_correct))

m = [] s = 1 1 1 0 1 missNums = 4

2   Pass
N = 10; ipArray = [4 10 7 6 1 3 5 8]; y1 = [2 9]; y2 = [9 2]; assert( isequal(findMissingNumbers(N, ipArray),y1)||isequal(findMissingNumbers(N, ipArray),y2) )

m = [] s = 1 0 1 1 1 1 1 1 0 1 missNums = 2 9

3   Pass
N = 100; vec = [1:5 7:32 34:96 98:100]; ipArray = vec(randperm(length(vec))); y1 = [ 97 33 6]; y2 = [ 97 6 33]; y3 = [ 33 97 6]; y4 = [ 33 6 97]; y5 = [ 6 97 33]; y6 = [ 6 33 97]; assert( isequal(findMissingNumbers(N, ipArray),y1)... || isequal(findMissingNumbers(N, ipArray),y2)... || isequal(findMissingNumbers(N, ipArray),y3)... || isequal(findMissingNumbers(N, ipArray),y4)... || isequal(findMissingNumbers(N, ipArray),y5)... || isequal(findMissingNumbers(N, ipArray),y6))

m = [] s = Columns 1 through 30 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 31 through 60 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 61 through 90 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 91 through 100 1 1 1 1 1 1 0 1 1 1 missNums = 6 33 97 m = [] s = Columns 1 through 30 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 31 through 60 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 61 through 90 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 91 through 100 1 1 1 1 1 1 0 1 1 1 missNums = 6 33 97 m = [] s = Columns 1 through 30 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 31 through 60 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 61 through 90 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 91 through 100 1 1 1 1 1 1 0 1 1 1 missNums = 6 33 97 m = [] s = Columns 1 through 30 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 31 through 60 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 61 through 90 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 91 through 100 1 1 1 1 1 1 0 1 1 1 missNums = 6 33 97 m = [] s = Columns 1 through 30 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 31 through 60 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 61 through 90 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 91 through 100 1 1 1 1 1 1 0 1 1 1 missNums = 6 33 97 m = [] s = Columns 1 through 30 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 31 through 60 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 61 through 90 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 91 through 100 1 1 1 1 1 1 0 1 1 1 missNums = 6 33 97

4   Pass
assessFunctionAbsence('ismember','FileName','findMissingNumbers.m');

Suggested Problems

More from this Author3

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!