Cody

# Problem 42586. Find Missing Number

Solution 1627350

Submitted on 14 Sep 2018 by Michael Cappello
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 = 32280 res = 72431 res = 14669 res = 55516 res = 3262 res = 45835 res = 5231 res = 33619 res = 56863 res = 37689 res = 78574 res = 3375 res = 54933 res = 2653 res = 25959 res = 87910 res = 44098 res = 6091 res = 63071 res = 67319 res = 63584 res = 99362 res = 98455 res = 44572 res = 27617 res = 61805 res = 12197 res = 91587 res = 93944 res = 61311 res = 31488 res = 64762 res = 25015 res = 56983 res = 95927 res = 85739 res = 79136 res = 23360 res = 24259 res = 75794 res = 13913 res = 96271 res = 57795 res = 24151 res = 14153 res = 16153 res = 56854 res = 32071 res = 22206 res = 42487 res = 4317 res = 26127 res = 7487 res = 40493 res = 15611 res = 78750 res = 50651 res = 44066 res = 23733 res = 28842 res = 41164 res = 11456 res = 32353 res = 64140 res = 5365 res = 26385 res = 29032 res = 18943 res = 16508 res = 31895 res = 54236 res = 99114 res = 78661 res = 35704 res = 3165 res = 81547 res = 8594 res = 23662 res = 84009 res = 47533 res = 98079 res = 96905 res = 3191 res = 60062 res = 57984 res = 10744 res = 35095 res = 43732 res = 8637 res = 46698 res = 57734 res = 64240 res = 45322 res = 35014 res = 44500 res = 45902 res = 71581 res = 953 res = 71657 res = 12477