Given a nonempty vector A, find the element whose distance from the mean of A is greatest. Return the element, not its distance. If there’s a tie, return the first such element.
Example:
Input: A = [5, 2, 1, 5, 6, 2, 5, 9]
Output: 9
The mean is 4.375, and 9 is farthest from it.
Solution Stats
Solution Comments
Show comments
Loading...
Problem Recent Solvers10
Suggested Problems
-
Find the Number Farthest from the Mean
10 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!