Algorithm · Google · Hard
You are given a non-empty list xs containing n finite real numbers. Three different scalar locations are defined by the objectives below. For each objective, find the value or values of theta that make the objective as small as possible. Subproblem 1 — Squared Loss Consider $$F_1(\theta)=\sum_{i=1}^{n}(x_i-\theta)^2 .$$ This objective has exactly one minimizing value. Return that value as a float. The computation must be done in one pass over xs. Subproblem 2 — Absolute Loss…
Checking your access…