Cody

# Problem 42989. Find unique number in input

Solution 1497311

Submitted on 19 Apr 2018 by Gareth Lee
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 = []; y_correct = 0; assert(isequal(uniqueNum(x),y_correct))

2   Pass
x = [1 7 7 1 7 6 3 7 6 7 3]; y_correct = 7; assert(isequal(uniqueNum(x),y_correct))

ans = 7

3   Pass
x = [21 62 85 21 85 13 49 5 56 20 62 37 4 4 63 49 56 20 63 37 5 ]; y_correct = 13; assert(isequal(uniqueNum(x),y_correct))

ans = 13

4   Pass
x = 1; y_correct = 1; assert(isequal(uniqueNum(x),y_correct))

ans = 1

5   Pass
[x, y] = test(1000, 1000); assert(isequal(uniqueNum(x),y)) function [input, unique] = test(n,m) unique = randi(n); array = [reshape(repmat(randi(n, 1, m), 2,1),1,[]), unique]; input = array(randperm(2*m+1)); end

ans = 200

### Community Treasure Hunt

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

Start Hunting!