This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
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))
|
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))
|
4 | Pass |
x = 1;
y_correct = 1;
assert(isequal(uniqueNum(x),y_correct))
|
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
|
1598 Solvers
404 Solvers
Back to basics 19 - character types
225 Solvers
360 Solvers
320 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!