Problem 661. Spot the outlier
All points except for one lie on a line. Which one is the outlier?
Example:
You are given a list of x-y pairs in a column like this:
pts = [ 0 1
0 2
3 2
0 3
0 4 ]
You would return the number 3, since the third point is the only one that is non-collinear with the other points. All the others are on the y-axis.
outlier = 3
Solution Stats
Problem Comments
-
3 Comments
Justin
on 29 Apr 2014
The instructions were a bit confusing at first. It would have been better to say "Find the row number of the outlying point."
Also, using the third row as an answer and a 3 in a column of zeros makes it seem like the intent was to provide unclear instructions. (Or they are just used to writing college textbooks ;) )
Wenwu
on 8 Jan 2015
The test set cases 2,3 seems to have two outliers for each case. Please check it
Josh
on 10 Aug 2023
i struggled with this one, not so much because of the concepts/maths involved, but because of issues with floating point precision that occur with test case 3 where my functions kept erroring after determining that 15.0000 ~= 15
Solution Comments
Show commentsGroup

ASEE Challenge
- 10 Problems
- 250 Finishers
- Find the biggest empty box
- How long is the longest prime diagonal?
- Flag largest magnitude swings as they occur
- Solitaire Cipher
- Spot the outlier
- How long is the longest prime diagonal?
- Solitaire Cipher
- Implement simple rotation cypher
- Given a window, how many subsets of a vector sum positive
- How many trades represent all the profit?
- Flag largest magnitude swings as they occur
- Make a run-length companion vector
- Spot the outlier
- Find a subset that divides the vector into equal halves
- How long is the longest prime diagonal?
- Find the biggest empty box
Problem Recent Solvers465
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!