Cody

# Problem 2456. remove single elements

Solution 476664

Submitted on 22 Jul 2014 by Jon
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
%% vec = [2 2 1 2 3 4 1 2]; out = [2 2 1 2 1 2]; assert(isequal(removeSingle(vec),out))

ans = 1 2 3 4 5

2   Pass
%% vec = ones(1,10000); out = vec; assert(isequal(removeSingle(vec),out))

ans = 1 2 3 4 5

3   Pass
%% vec = []; out = []; assert(isequal(removeSingle(vec),out))

ans = 1 2 3 4 5

4   Pass
%% vec = [1 2 3 4 5]; out = []; assert(isequal(removeSingle(vec),out))

ans = 1 2 3 4 5

5   Pass
%% vec = [4 4 5 5 1 1 2 2]; out = vec; assert(isequal(removeSingle(vec),out))

ans = 1 2 3 4 5

6   Pass
%% vec = [4 1 4]; out = [4 4]; assert(isequal(removeSingle(vec),out))

ans = 1 2 3 4 5

7   Pass
%% s = evalc('type removeSingle'); if (~isempty(regexp(s,'for'))) | (~isempty(regexp(s,'while'))) | (~isempty(regexp(s,'assert'))) | (~isempty(regexp(s,'error'))) while(1) end end

### Community Treasure Hunt

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

Start Hunting!