Cody

# Problem 42586. Find Missing Number

Solution 770236

Submitted on 2 Nov 2015 by Carl Witthoft
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
%% x = 10; y=2:10; y_correct = 1; assert(isequal(find_missing_number(x,y),y_correct))

res = 1

2   Pass
%% x = 100; y=1:99; y_correct = 100; assert(isequal(find_missing_number(x,y),y_correct))

res = 100

3   Pass
%% x = 1000; y=1:1000; y(end/2)=[]; y_correct = 500; assert(isequal(find_missing_number(x,y),y_correct))

res = 500

4   Pass
%% x = 2; y=2; assert(isequal(find_missing_number(x,y),1))

res = 1

5   Pass
%% x = 2; y=1; assert(isequal(find_missing_number(x,y),x))

res = 2

6   Pass
%% x = 100000; y=1:x; y(end-3)=[]; assert(isequal(find_missing_number(x,y),x-3))

res = 99997

7   Pass
%% x = 100000; for b=1:100 y=1:x; y=y(randperm(x)); val=randi([1 x]); y_correct = y(val); y(val)=[]; assert(isequal(find_missing_number(x,y),y_correct)) end

res = 69290 res = 91702 res = 62615 res = 88767 res = 52451 res = 74904 res = 42317 res = 32179 res = 28104 res = 66018 res = 53107 res = 77326 res = 28875 res = 69441 res = 34251 res = 35853 res = 97307 res = 76894 res = 38416 res = 37166 res = 84088 res = 85257 res = 64025 res = 25489 res = 39781 res = 40401 res = 91253 res = 6986 res = 70345 res = 39171 res = 55198 res = 60219 res = 67121 res = 42263 res = 57244 res = 84676 res = 24316 res = 37352 res = 23798 res = 62812 res = 94066 res = 89896 res = 83979 res = 78734 res = 26774 res = 87510 res = 97201 res = 42407 res = 74877 res = 38695 res = 20129 res = 76244 res = 17910 res = 40769 res = 43308 res = 9791 res = 58032 res = 5651 res = 6398 res = 41132 res = 52173 res = 46289 res = 51268 res = 22615 res = 76313 res = 91902 res = 68478 res = 59988 res = 57536 res = 74918 res = 60420 res = 30942 res = 576 res = 15570 res = 24771 res = 88399 res = 15740 res = 11539 res = 96888 res = 88321 res = 89587 res = 54735 res = 93026 res = 84211 res = 98849 res = 32546 res = 42153 res = 25018 res = 19688 res = 13392 res = 11980 res = 22812 res = 53244 res = 91945 res = 19608 res = 98844 res = 85793 res = 46611 res = 78513 res = 92677