Cody

# Problem 661. Spot the outlier

Solution 3378878

Submitted on 25 Oct 2020
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   Fail
pts = [0 1; 0 2; 3 2; 0 3; 0 4 ]; outlier = 3; assert(isequal(spot_the_outlier(pts),outlier))

h = 5×1 logical array 1 1 0 1 1 h = 5×1 logical array 1 1 0 1 1 h = 5×1 logical array 0 0 1 0 0 h = 5×1 logical array 1 1 0 1 1 h = 5×1 logical array 1 1 0 1 1

Assertion failed.

2   Fail
pts = [10 -1;7 0;9.5 0.3;9 1.6;8.5 2.9]; outlier = 2; assert(isequal(spot_the_outlier(pts),outlier))

h = 5×1 logical array 1 0 0 0 0 h = 5×1 logical array 0 1 0 0 0 h = 5×1 logical array 0 0 1 0 0 h = 5×1 logical array 0 0 0 1 0 h = 5×1 logical array 0 0 0 0 1

Assertion failed.

3   Fail
pts = [-0.6 -6;-0.2 0;0 3;-0.8 -9;-2 1;-0.4 -3]; outlier = 5; assert(isequal(spot_the_outlier(pts),outlier))

h = 6×1 logical array 1 0 0 0 0 0 h = 6×1 logical array 0 1 0 0 0 0 h = 6×1 logical array 0 0 1 0 0 0 h = 6×1 logical array 0 0 0 1 0 0 h = 6×1 logical array 0 0 0 0 1 0 h = 6×1 logical array 0 0 0 0 0 1

Assertion failed.

4   Fail
pts = [2 5;0 4;0 0;4 6;-2 3]; outlier = 3; assert(isequal(spot_the_outlier(pts),outlier))

h = 5×1 logical array 1 0 0 0 0 h = 5×1 logical array 0 1 1 0 0 h = 5×1 logical array 0 1 1 0 0 h = 5×1 logical array 0 0 0 1 0 h = 5×1 logical array 0 0 0 0 1

Assertion failed.

5   Fail
pts = [1 0; 0 1; 1 2; 1.5 2.5; 2 3; 3 4 ]; outlier = 1; assert(isequal(spot_the_outlier(pts),outlier))

h = 6×1 logical array 1 0 1 0 0 0 h = 6×1 logical array 0 1 0 0 0 0 h = 6×1 logical array 1 0 1 0 0 0 h = 6×1 logical array 0 0 0 1 0 0 h = 6×1 logical array 0 0 0 0 1 0 h = 6×1 logical array 0 0 0 0 0 1

Assertion failed.

### Community Treasure Hunt

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

Start Hunting!