Cody

# Problem 661. Spot the outlier

Solution 3901398

Submitted on 29 Nov 2020 by Yash Pachaury
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
pts = [0 1; 0 2; 3 2; 0 3; 0 4 ]; outlier = 3; assert(isequal(spot_the_outlier(pts),outlier))

pts0 = 0 1 m0 = 1.5708 m = 0.3218 m = 1.5708 m = 1.5708 GC = 1 3 GR = 0.3218 1.5708 outlier = 3

2   Pass
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))

pts0 = 10 -1 m0 = -0.3218 m = -1.2036 m = -1.2036 m = -1.2036 GC = 3 1 GR = -1.2036 -0.3218 outlier = 2

3   Pass
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))

pts0 = -0.6000 -6.0000 m0 = 1.5042 m = 1.5042 m = 1.5042 m = -1.3734 m = 1.5042 GC = 1 4 GR = -1.3734 1.5042 outlier = 5

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

pts0 = 2 5 m0 = 0.4636 m = 1.1903 m = 0.4636 m = 0.4636 GC = 3 1 GR = 0.4636 1.1903 outlier = 3

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

pts0 = 1 0 m0 = -0.7854 m = 1.5708 m = 1.3734 m = 1.2490 m = 1.1071 GC = 1 1 1 1 1 GR = -0.7854 1.1071 1.2490 1.3734 1.5708 outlier = 1

### Community Treasure Hunt

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

Start Hunting!