About this question

Mean Absolute Deviation

Easy · mle_slice · Quant Researcher interview question · mle-slice

Given a non-empty list of floats xs, return the mean absolute deviation: the average of |x - mean(xs)| over all elements. Example: xs = 1.0, 2.0, 3.0, 4.0 has mean 2.5, so the answer is (1.5 + 0.5 + 0.5 + 1.5) / 4 = 1.0.