← All problemsSign in

Minimum Variance

You are given $n$ sets $S_1, S_2, \ldots, S_n$. For each $i$, you want to choose $x_i \in S_i$, such that the variance of the multiset $\{x_1, x_2, \ldots, x_n\}$ is minimized. The variance of a multiset $\{x_1, x_2, \ldots, x_n\}$ is defined as $\sigma^2 = \displaystyle \dfrac{\sum_{i=1}^{n} (x_i - \mu)^2}{n} $, where $\mu$ is the mean, which equals $\displaystyle \dfrac{ \sum_{i=1}^{n}x_i}{

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start