Cody

# Problem 2456. remove single elements

Solution 1145631

Submitted on 25 Mar 2017 by shahriar memaran
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))

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

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

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

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

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

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!