Cody

# Problem 42586. Find Missing Number

Solution 1095691

Submitted on 31 Dec 2016 by Pritesh Shah
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 = 90368 res = 95751 res = 10963 res = 78789 res = 1976 res = 87925 res = 31062 res = 17536 res = 18048 res = 2248 res = 24181 res = 65237 res = 6729 res = 15164 res = 13667 res = 11325 res = 29542 res = 23146 res = 78583 res = 44432 res = 62516 res = 49528 res = 2817 res = 976 res = 5857 res = 4658 res = 36979 res = 61772 res = 96942 res = 65464 res = 6176 res = 34359 res = 9815 res = 48243 res = 29824 res = 15991 res = 42573 res = 43310 res = 64325 res = 9145 res = 46688 res = 66969 res = 49987 res = 21574 res = 69500 res = 70735 res = 14579 res = 94645 res = 38910 res = 47838 res = 41893 res = 75550 res = 71303 res = 35349 res = 69181 res = 4332 res = 35908 res = 92665 res = 1517 res = 89316 res = 71139 res = 58941 res = 31922 res = 77459 res = 52607 res = 47646 res = 2888 res = 78125 res = 39069 res = 41228 res = 12235 res = 51784 res = 94742 res = 74570 res = 2640 res = 81943 res = 52955 res = 78772 res = 9275 res = 75428 res = 26831 res = 53913 res = 72840 res = 72449 res = 54433 res = 58818 res = 58943 res = 99896 res = 51545 res = 7268 res = 62367 res = 43895 res = 33603 res = 99313 res = 42484 res = 72761 res = 71916 res = 88969 res = 13809 res = 49379

### Community Treasure Hunt

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

Start Hunting!