Cody

# Problem 42586. Find Missing Number

Solution 770507

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 = 75548 res = 1714 res = 97536 res = 34410 res = 1699 res = 3785 res = 63043 res = 70142 res = 72625 res = 10020 res = 95642 res = 68975 res = 59089 res = 25188 res = 21951 res = 83786 res = 29626 res = 8779 res = 37340 res = 524 res = 85036 res = 36952 res = 11032 res = 59257 res = 84935 res = 31556 res = 89891 res = 91726 res = 27974 res = 13543 res = 94943 res = 88240 res = 38418 res = 97841 res = 8902 res = 12064 res = 82905 res = 93926 res = 34898 res = 27608 res = 98702 res = 41831 res = 68778 res = 40090 res = 48553 res = 38097 res = 7169 res = 55797 res = 4241 res = 58839 res = 3893 res = 27537 res = 8981 res = 57683 res = 82694 res = 70035 res = 65831 res = 56084 res = 3948 res = 9083 res = 67232 res = 35075 res = 87390 res = 66512 res = 96926 res = 42187 res = 6177 res = 22401 res = 41628 res = 72761 res = 72863 res = 90050 res = 26066 res = 6330 res = 4807 res = 75112 res = 40183 res = 62904 res = 78890 res = 73895 res = 1673 res = 38673 res = 47084 res = 93997 res = 21042 res = 5694 res = 20177 res = 59499 res = 22879 res = 63776 res = 21195 res = 20367 res = 78035 res = 41688 res = 62446 res = 73692 res = 58458 res = 28266 res = 31619 res = 48688

### Community Treasure Hunt

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

Start Hunting!