Cody

# Problem 980. Unique values without using UNIQUE function

Solution 1625378

Submitted on 11 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
filetext = fileread('your_fcn_name.m') assert(isempty(strfind(filetext, 'unique'))) assert(isempty(strfind(filetext, 'stable'))) A = [9 2 9 5]; assert(isequal(your_fcn_name(A),unique(A,'stable')))

filetext = 'function x = your_fcn_name(x) kill = false(size(x)); for i=1:length(x)-1 kill(i+1:end) = kill(i+1:end) | (x(i+1:end)==x(i)); end x(kill) = [] end %This code written by profile_id 34524 ' x = 9 2 5

2   Pass
x = [42 1 1 1 42 17 17]; assert(isequal(your_fcn_name(x),unique(x,'stable')))

x = 42 1 17

3   Pass
x = rand(1,25); assert(isequal(your_fcn_name(x),unique(x,'stable')))

x = Columns 1 through 18 0.4454 0.8930 0.6653 0.1584 0.6357 0.6496 0.8667 0.0559 0.1715 0.5693 0.7578 0.5656 0.0485 0.2839 0.7505 0.7130 0.4912 0.3497 Columns 19 through 25 0.7042 0.5692 0.4003 0.9392 0.2795 0.8926 0.6929